Objective-C's class libraries define the
NSJSONSerialization class, which can serialize to and from JSON. It converts JSON to
NSDictionary objects of values, with the keys, the names of the slots in the JSON, and the values of their JSON. It's available in iOS 5.0 and later.
Here's a simple example:
NSError* error; NSDictionary* data = [ NSJSONSerialization JSONObjectWithData: json options: kNilOptions error: &error ]; NSString* call = [ data ObjectForKey: @"call" ];
NSJSONSerialization class has a method,
JSONObjectWithData:options:error, that takes an
NSString, parsing options, and a place to record errors, and performs JSON parsing. It can accept JSON whose top level is an array ...