You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
do you think it would be possible to add compatibility mode to enforce JSON output strictly corresponding to standard of choice? eg. RFC 8259.
We have issues that json-c is generating JSON code containing NaNs, which is possible in ECMA, but not in RFC. Using null in such case might make sense.
The text was updated successfully, but these errors were encountered:
Number: a signed decimal number that may contain a fractional part and may use exponential E notation, but cannot include non-numbers such as NaN. https://en.wikipedia.org/wiki/JSON
json-c will report error "null expected" when it parse "NaN" in STRICT mode. Maybe you use it in wrong way?
While there's a strict mode when parsing json, there is generally no validation if you're working with json_object's, nor when a tree of json_object's is serialized into a json string.
I suppose one option would be to fail (crash?) if you call json_object_new_double() that way.
Or, we could add a "strict output" flag to json_object_to_json_string_ext(), but then we'd also need to add some way to indicate where in the tree it failed.
Neither one of these seems like a good option. Instead, I'd say that if you don't want NaN in the output, don't call json_object_new_double(NAN).
Hello,
do you think it would be possible to add compatibility mode to enforce JSON output strictly corresponding to standard of choice? eg. RFC 8259.
We have issues that json-c is generating JSON code containing NaNs, which is possible in ECMA, but not in RFC. Using null in such case might make sense.
The text was updated successfully, but these errors were encountered: