1

I've seen the comparison thread on objective-c JSON parsers here: Comparison of JSON Parser for Objective-C (JSON Framework, YAJL, TouchJSON, etc) but can someone offer their opinions on which is the easiest/simplest to setup and to use?

Community
  • 1
  • 1
Joey
  • 7,537
  • 12
  • 52
  • 104

1 Answers1

3

I prefer json-framework simply because it just works =) Here is how to parse:

NSObject* parsed_obj = [[[[SBJsonParser alloc] init] autorelease] objectWithData: data];

And that's all!

parsed_obj could be NSArray or NSDictionary. You should check this using iskindOfClass: method. And then you work with with simple containers. BTW it has convenient categories for NSDictionary, NSArray, NSData in the later release.

Max
  • 16,679
  • 4
  • 44
  • 57
  • I find it ironic that you cite json-framework for its ease-of-use, but don't use the `-[NSString JSONValue]` method as your example :) – Dave DeLong Mar 01 '11 at 06:31
  • @Dave DeLong i've copied an example from my old project where i had to parse data received from web server. – Max Mar 01 '11 at 07:21