JSONKit parsing json string JSONKit parsing json string json json

JSONKit parsing json string


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.