Reputation: 153
I am working with a huge JSON object and i need to extract a single parameter from it.
Is there a way to query the JSON object for the parameter?
Upvotes: 2
Views: 83
Reputation: 726589
You need a streaming JSON parser for that, i.e. a parser that produces events to which you listen as it goes through the JSON input, as opposed to document-based parsers, such as NSJSONSerialization
of iOS 5+.
One of such parsers is YAJL: although it is a C library, you can use it from Objective C as well: all you need to do is defining a yajl_callbacks
, put pointers to the handlers for the type of the item that you wish to extract, call the parser, and let the parser do the rest.
Upvotes: 2