It looks like NSJSONSerialization will serialize your values โโas doubles, even though the doubles are not accurate enough to represent specific values โโexactly. Read more here: Does NSJSONSerialization perform deserialization of numbers as NSDecimalNumber?
If accuracy is not very important, you can simply round off your values, but since you are dealing with what seems like a financial application, it would be better to turn your values โโinto integers by multiplying them by 1000, and then back:
{"bid":88667,"ask":88704}
An alternative is to use strings.
savanto
source share