开发者

JSONKit parsing json string

How to use JSONKit to deserialize a json string into dictionary? I couldn开发者_Go百科't find any examples.


Use the NSString interface that comes with JSONKit. For example:

NSDictionary *deserializedData = [jsonString objectFromJSONString];

You'll either need to know in advance what sort of container you're going to get from the JSON data, or else test the object you get back to figure out its type. (You can use -isKindOfClass: for this.) Most of the time, you already have an expectation of what's in the JSON data, so you know to expect a dictionary or an array, but it's still a good idea to check the class of the object you get back.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜