How to convert JSON data to Objects in iPhone [duplicate]

有些话、适合烂在心里 提交于 2019-12-13 04:59:25

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5645703/how-to-convert-json-data-to-objects-in-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!