Possible Duplicate:
How to get and parse JSON using objective C?
Recently I have discovered JSON can be used to send data to iPhone.
开发者_开发百科In my application there is lot of communication between the server so I construct lot of objects (classes) in various places. Currently I am manually constructing my classes from the data I get from json.
Is there a framework or source code that does this conversion automatically after all we know object information we get from the service. I can pass the class structure and it will create a Array of those objects from json data.
Yes:
http://code.google.com/p/json-framework/
Import the framework, send the JSON string -[NSString JSONValue]
and you'll get back either an NSDictionary
or an NSArray
.
精彩评论