At json.org the grammar for numbers does not limit the precision to IEEE double precision.
There are specifications (e.g. OData 4.0) which pemit decimal/integer values being encoded as JSON numbers that might go outside the range of IEEE double, with an expectation that agents (clients and servers) will preserve the precision.
Therefore you may find that when working with such specifications, and with JSON parsing in Swift, you need your own (or a third-party) JSON parser if arbitrary integer/decimal precision needs to be retained when using JSON numbers rather than JSON strings for the arbitrary precision integer/decimal encoding.
Some folks might wish to consider this as a defect in the JSON parser, others may see it as an issue with the way that values are being encoded in JSON.
Now I-JSON (see draft-ietf-json-i-json-03 - The I-JSON Message Format) defines some extra constraints to avoid such interoperability issues.
From: Rimantas Liubertas <firstname.lastname@example.org>
To: swift-users <email@example.com>
Subject: Re: [swift-users] Parsing Decimal values from JSON
> because JS doesn't know about decimals doesn't mean swift can't do better.
JSON does not know about decimals either. JSON. If you need
some custom data type you can always pass it as a string and then handle as