views:

1944

answers:

2

As far as I know, there are three JSON Parsers for Objective-C, JSON Framework, YAJL, and Touch JSON. Then, These three would have their own characteristics.

For example:
YAJL can be used as a SAX style parser.
JSON Framework has relatively long history and is widely used.
Touch JSON parses NSData instead of NSString.

In addition, as far as I tested, the result of performance comparison is as follows:
[fast] YAJL > JSON Framework > Touch JSON [slow].

If you know pros and cons of these JSON parsers, could you tell me?
Lastly, if you know any other JSON Parser, please tell me.

+3  A: 

I had the same results as you for JSON Framework and TouchJSON. TouchJSON claims to be faster, but my test with parsing one big (10K array objects) JSON string was different, JSON Framework was faster. Didn't know about YAJL.

Jaanus
Thank you for the answer. I did a test to try to get my Twitter timeline via their API (used actual device). As a result, YAJL is twice faster than JSON Framework. YAJL 0.09sec > JSON Framework 0.18sec > TouchJSON 0.23sec.
tomute
A: 

There's also this parser: http://github.com/sazameki/json-objc-parser

I don't remember how I stumbled upon this one, but it looked lightweight and simple, so I thought that it suits my needs. I event forked it in order to add initialization from NSData. As I needed to parse small responses, I didn't care about the performance. It would be interesting to know how it performs though.

Roman