Skip to content

Numbers returned as strings #8

@Crashthatch

Description

@Crashthatch

Numbers are double-quoted in the returned JSON as described in your documentation:

For numbers, JSON specifies the precision of IEEE doubles, but numeric data in SODA can sometimes require a higher level of precision.To handle this case, numbers in SODA are returned as quoted strings. If you want to have numbers return as doubles in the JSON, you can cast them to doubles in the $select part of the SoQL.

However I can find no documentation that says how to cast them to doubles. I tried all the obvious things in the $select like doing arithmetic to them in the, wrapping with double(myCol), cast(myCol, double), myCol::DOUBLE etc. but they all fail.

What is the correct way, and can you add it to the documentation?

Example. Note occupancy is enclosed by "double-quotes" despite being set as a "number":
http://data.bathhacked.org/resource/x29s-cczc.json?$select=name,lastupdate,occupancy&$where=lastupdate%3E%272014-11-25%27%20AND%20lastupdate%3C%272014-11-29%27&$limit=10000&$offset=0

Example using column arithmetic:
http://data.bathhacked.org/resource/x29s-cczc.json?$select=name,lastupdate,occupancy*2&$where=lastupdate%3E%272014-11-25%27%20AND%20lastupdate%3C%272014-11-29%27&$limit=10000&$offset=0

Thanks,
Tom.

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