What is the best way to analyze the array of dictionaries in JSON?

advertisements

I have a huge JSON data which is containing array of dictionaries, and each dictionary containing lots of key-value pares.

I have to parse each dictionary into models(NSObject models).

What is the best and good way to do this? Right now i am converting the JSON using SBJSON framework and iterating the array and then storing each key-value, in dictionary, to NSObject model.

Thanks in advance.


An informal protocol, NSKeyValueCoding, is likely what you want. It contains a setValuesForKeysWithDictionary: method, that will let you turn a dictionary into an Objective-C object of your choice. Assuming the key names match the property names, that is.

Combine that with a for loop, and, you've got a pretty quick way to make native ObjC objects from JSON.