bignerdranch / Freddy

A reusable framework for parsing JSON in Swift.
MIT License
1.09k stars 119 forks source link

Freddy fails to decode large integers on 32-bit devices #204

Closed cbrauchli closed 8 years ago

cbrauchli commented 8 years ago

If I attempt to decode a large number on a 32-bit device, such as an iPhone 5, I get errors like:

ValueNotConvertible(1472861857112, Swift.Double)

Seems to be because the number overflows, triggers a InternalError.NumberOverflow in the parser, and JSONDecodable cannot convert a String to a Double. I think there are a few workarounds:

  1. Make JSONDecodable's Double extension handle String objects.
  2. Force JSONParser to use Int64 for decoding integral values, always.
  3. Attempt to decode with Int64 on 32-bit architectures if Int decoding overflowed.
mdmathias commented 8 years ago

Closed via #194