There is a bug in iOS 10, that Swift 4's JSONDecoder
does not decode some huge 64 bit integers from JSON with error "Parsed JSON number <1522853867156381000> does not fit in Int64."
This is not happening in iOS 11 and it is a known bug
None of NSNumber
, NSDecimalNumber
and NSValue
implement the Decodable
protocol so I have not found a way to decode them from a Decoder
.
So the question is how to decode such numbers with Codable
/Decodable
?
Changing the JSON, to have the numbers as strings, is not an option.
EDIT: As there is no workaround we have chosen the "not an option" and updated the server to return 64 bit integers also as strings.