开发者

How to convert JSON object to Objective-C Cocoa object?

Am developing a cocoa app开发者_如何学Pythonlication, where I have to invoke java web scripts and fetch the response of the web script object and convert it into Objective C readable objects. I would then need to manipulate the fetched data for import, print, etc.

How to I interact with the web script and convert into cocoa readable objects?

Any pointers on the same, will be appreciated.

Thanks, Nana


  1. Convert the JSON string into an NSDictionary using tools like yajl, JSONKit or iOS5 JSON

  2. Use https://github.com/elado/jastor to convert this NSDictionary to a real Objective-C class with typed properties, nested properties, arrays etc.


In iOS 5 native JSON parsing is supported (documentation). In addition you can use a number of third party libraries to download and parse JSON (see JSONKit and HTTPRiot or RestKit)

A full reference of awesome libraries can be found here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜