I'm using NSJSONSerialization to turn a JSON document into the Core Foundation types.
I have a field in my JSON which is a "number". It's sometimes and integer, sometimes a float.
Now, the problem is when NSJSONSerialization turns my JSON into an NSDictionary and I try to extract the number using objectForKey, sometimes it's an int, and sometimes it's a double. It seems NSJSONSerialization doesn't simply leave it in an NSNumber wrapper, but actually unboxes the value, and inserts that into the NSDictionary.
Very strange. I thought you we're supposed to put primitives into an NSDictionary. So the problem I have now is that I don't know what type (int or double) I should be casting to to preserve the actual number value.
Anyone know a way out?