How to parse JSON in iOS App

前端 未结 6 1978
栀梦
栀梦 2020-11-29 09:55

Im getting a response from twitter in the form of a string,

What I need is to send the parts where is a comment to an array,

here an example of the string

6条回答
  •  抹茶落季
    2020-11-29 10:36

    I recently had to do this. After looking at the various options out there, I threw JSONKit into my app (I found it on a JSON discussion on StackOverflow). Why? A) It is VERY VERY simple. I mean, all it has is the basic parsing/emitting functions, what more do you need? B) It is VERY VERY fast. No overhead - just get the job done.

    I should note, I had never done JSON before - only heard of the term and didn't even know how to spell it. I went from nothing, to a working app, in about 1 hour. You just add one class to your app (the .h, .m), instantiate it, and call the parser to a dictionary object. Voila. If it contains an array, you just get the objectForKey, cast it as an NSArray. It's really hard to get simpler than that, and very fast.

提交回复
热议问题