Skip to content

Json.FromText fails with float types? #24

@janusdotai

Description

@janusdotai

Greetings,

I'm seeing the JSON parser fail when encountering a field with a FLOAT type? For example, this works fine

const data = "{\"code\":\"EUR\",\"alphaCode\":\"EUR\",\"numericCode\":\"978\",\"name\":\"Euro\",\"rate\": \"0.92365973383771\"}";

but this does not:

const data = "{\"code\":\"EUR\",\"alphaCode\":\"EUR\",\"numericCode\":\"978\",\"name\":\"Euro\",\"rate\": 0.92365973383771}";

The 2nd example has a FLOAT type field for "rate" (the first example would be a string because its text-qualified)

When I run standard code like let t = JSON.fromText(data, null); it throws an error for the 2nd case which is

#err("Failed to parse JSON text")
float serialization

Do you think its a problem with the Float type? I could change my webservice to force text-qualify all fields as a work-around but I figured i'd report this potential issue to see if you were aware of it. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions