If you want a more complete solution offered by the stand-alone parsing library, you can take a look at RestKit: http://restkit.org/
The structure wraps the operations of selecting, parsing and mapping useful JSON data into objects. It also allows you to update remote views by POST / PUT'ing objects back with the request. By default, outgoing requests are encoded by forms, but the library comes with a class for using JSON as a wire format for sending to the server.
At a high level, here is what your send and receive operations will look like in RestKit:
- (void)loadObjects { [[RKObjectManager sharedManager] loadObjectsAtResourcePath:[@"/path/to/stuff.json" delegate:self]; } - (void)objectLoader:(RKObjectLoader*)loader didLoadObjects:(NSArray*)objects { NSLog(@"These are my JSON decoded, mapped objects: %@", objects);
The structure takes care of parsing / encoding JSON in the background thread and allows you to declare how the attributes on the JSON map correspond to the properties of your object. Comparison of the main classes supported by the database is fully supported.
source share