Skip to content

Generated types not working for floats #198

@dchansen

Description

@dchansen

JSON3 casts all floating points to integers, as long as it can be done without loss of precision.
I.e.

test = "{ \"A\": 0.0 }"
x = JSON3.read(test)

JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
  :A => 0

However this behaviour causes generated types to not work correctly:

JSON3.@generatetypes test
JSON3.read(test,JSONTypes.Root)

ERROR: ArgumentError: invalid JSON at byte position 9 while parsing type Main.JSONTypes.Root: ExpectedComma
{ "A": 0.0 }

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions