Skip to content

fromJson raise JsonError with valid json #30

@maxisoft

Description

@maxisoft

Hello,

It seems jsony json parser has issue parsing some floats with E scientific notation.

Here's the minimal exemple code to reproduce the issue:

import jsony
import std/json

let s = r"""[9e-8]"""
#echo s
echo parseJson(s) # std json parse works
echo fromJson(s) # Invalid float. At offset: 5 [JsonError]

Some running context:

  • Nim Compiler Version 1.6.0 [Windows: amd64]
  • jsony installed with nimble install jsony today (2021-11-04)
  • throw in release or debug mode, no other compiler flags used

The Issue

The payload [9e-8] is a valid json and std/json or python json parser handle it without raising errors.
Jsony should be able to parse it successfully.

Please note that, for now, I only encoutered this error with this specific value 9e-8.
Other values parsed with jsony (even those in E scientific notation) are successfully parsed.

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions