logoalt Hacker News

q3ktoday at 4:52 PM1 replyview on HN

Happy to see that numbers are arbitrary width/precision until explicitly cast by the user. This goes against so many other JSON libraries that will always cast all numbers to double (or even float) thereby silently corrupting JSON numbers representing large values (eg. memory addresses).

Does anyone know how this behaves when encountering a repeated key in an object? (RFC8259 states that keys SHOULD be unique, which makes that generally allowed and implementations all behave slightly differently).


Replies

lmztoday at 5:18 PM

Not sure why they didn't include the BigDecimal conversion directly on the JsonNumber object instead of going through the String representation.

Duplicate keys are a parse exception.

> Additionally, documents must not have objects with duplicate member names.

show 1 reply