JSON Framework for iPhone

Mon, Oct 13

Editor’s Note: Due to the popularity of this iPhone JSON series, a new three part tutorial series on working with JSON was published in August 2009. You can find the latest JSON iPhone tutorial series at the links below:

  1. iPhone JSON and Flickr Tutorial – Part 1
  2. iPhone JSON and Flickr Tutorial – Part 2
  3. iPhone JSON and Flickr Tutorial – Part 3

If you’ve found a need to work with JSON and the iPhone, Stig Brautaset has written a nice framework that is available on github.

This framework implements a strict JSON parser and generator in Objective-C. It’s easy to work with and can be used across any number of projects with ease.

To use this framework it was pretty straightforward to get things in place, copy the included "SDKs" folder onto your local system (into ~/Library/SDKs). From within a project, modify the target build options to point to the SDK and add a link option to include the necessary library into the build.

From this point forward, the SDK is now available for use within any iPhone project, simply update the build settings and you are good to go.

You can find Part 2 of working with JSON here.

4 comments

Thanks for this great tip!

I’ve got a problem with an aspect of the INSTALL readme which comes with the framework. Could you possibly outline detailed steps as to achieving this:

“You also have to add a “Copy files” build phase to copy the
framework into your application. This should copy files to the
Frameworks folder inside Resources.

http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880-BAJJBIEF

I’ve read the referenced Apple link but could not get it to work. Is this step REQUIRED at all?

by Ralf on Feb 1, 2009. #

I haven’t started using the framework, but I got the sense that that section is mutually exclusive with the previous steps. I think frameworks added under resources are a part of Mac OS X applications, not iPhone ones.

by Bill Brown on Apr 16, 2009. #

Probably a bit late entering the discussion here, but recorded for posterity.

Ralf, Bill is right. You have to read the INSTALL file a bit more carefully. You should not use the Embedded Framework on the iPhone. It simply will not work.

by Stig Brautaset on May 17, 2009. #

Can someone please show an example of doing a POST and handling the returned data with both:

http://www.example.com?username=“me”&password=”you”

and a REST POST:

http://www.example.com?s={“cows” : 1},{“chickens” : 47}]

using the JSON framework?

by Dan B. on Sep 7, 2012. #