Native JSON support in iOS?

后端 未结 5 769
醉话见心
醉话见心 2020-11-27 04:22

Is there a class to parse JSON from a server in the iOS SDK? (similar to NSXML for XML and by extension RSS.)

5条回答
  •  孤城傲影
    2020-11-27 05:14

    Updated answer for iOS 5:

    JSON support is now native to iOS with NSJSONSerialization, but in terms of performance, it pales in comparison to JSONKit, as John Englehart stated in the JSONKit README:

    UPDATE: (2011/12/18) The benchmarks below were performed before Apples NSJSONSerialization was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, NSJSONSerialization or JSONKit? According to this site, JSONKit is faster than NSJSONSerialization. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than NSJSONSerialization, which is pretty significant.

    enter image description here

    Here's a blog post which delves into more specific benchmarks: JSON Libraries for iOS Comparison

提交回复
热议问题