Objective-C types are mapped to JSON types in the following way:
- NSNull -> null
- NSString -> string
- NSArray -> array
- NSDictionary -> object
- NSNumber's -initWithBool:YES -> true
- NSNumber's -initWithBool:NO -> false
- NSNumber -> number
- 覚え書き
- In JSON the keys of an object must be strings. NSDictionary keys need not be, but attempting to convert an NSDictionary with non-string keys into JSON will throw an exception.
NSNumber instances created with the -numberWithBool: method are converted into the JSON boolean "true" and "false" values, and vice versa. Any other NSNumber instances are converted to a JSON number the way you would expect.