进行JSON转化的时候,需要满足一下的要求。
An object that may be converted to JSON must have the following properties:
- The top level object is an NSArray or NSDictionary.
- All objects are instances of NSString,NSNumber,NSArray,NSDictionary,or NSNull.
- All dictionary keys are instances of NSString.
- Numbers are not NaN or infinity.
也就是说,
- 最上面层,必须是 NSArray 或 NSDictionary
- 所有的value 必须是 NSString,NSNubmer,NSDictionar 或 NSNull.
- 所有的key 必须是 NSString
- 并且Numbers 不能是 NaN 或 无穷大。