I use NSJSONSerialization to turn a JSON document into Core Foundation types.
I have a field in my JSON that is a "number". This is sometimes an integer, sometimes floating.
Now the problem is that NSJSONSerialization turns my JSON into an NSDictionary , and I'm trying to extract a number using objectForKey, sometimes it is int and sometimes double. It seems that NSJSONSerialization does not just leave it in the NSNumber , but actually releases the value and inserts it into the NSDictionary .
Very strange. I thought you should put primitives in NSDictionary . So the problem that I am facing right now is that I do not know what type (int or double) I should use to store the actual value of the number.
Does anyone know a way out?
source share