Install json-framework

If you are attempting to write a Iphone application to talk to a webservice, JSON is one of the best ways to go. Now unfortunately there is no native support in the Iphone SDK for JSON. There is a project called json-framework that provides a framework called json-framework.

There is little documentation on how to install it though. Recently I found a news group posting on how to do it along with a dmg! I have mirrored the dmg file just in case it gets removed from that posting.

So here are some instructions on how to install it.

  • Download the dmg file
  • Make a directory called SDKs in your ~/Library/ directory. So if you username is bob. it would be /Users/bob/Library/SDKs
  • Copy the JSON directory to SDKs so you should have a directory called /Users/bob/Library/SDKs/JSON which has iphoneos.sdk and iphonesimulator.sdk directories inside it.
  • In Xcode load up your project and go to Project -> Edit Project Settings. You will see a box like this

  • At the top you will see Additional SDKs. Double click that and you will see

  • Now click the + sign and it will prompt you to add a directory. You will enter the following line
$HOME/Library/SDKs/JSON/$(PLATFORM_NAME).sdk
  • Now you need to add in the linker options. So now look for Other Linker Flags and add in the following
-ObjC -ljson
  • Now you can import the <JSON/JSON.h> header file and begin coding.

I have also mirrored their test application they built in the news group post. So if you download that and make the project changes there, you should be able to compile touchJSON into your application.

Comments

20 Responses to “Install json-framework”

  1. touchjson or touchxml - iPhone Dev SDK Forums on August 5th, 2008 8:42 am

    [...] Seems someone on a new group put together a dmg for touchjson yesterday. Here is a link to my blog on how to install it if anyone else is wondering this Install TouchJSON | Iphone Noob [...]

  2. First JSON Iphone application | Iphone Noob on August 5th, 2008 10:23 am

    [...] now that we have the basics of installing JSON to our project, lets make a test [...]

  3. Stig Brautaset on August 23rd, 2008 4:16 am

    Hi, I’m the author of both the JSON Framework and the newsgroup posting you reference above.

    I just wanted to let you know that from version 2.1 onwards, official downloads of the framework come with iPhone-ready SDKs.

    (BTW: I’m a bit curious why the the slug refers to touchjson; that’s part of an unrelated project called touchcode.)

  4. More Complex JSON endpoint : Iphone Noob on September 26th, 2008 8:03 am

    [...] sure you have JSON Framework installed [...]

  5. Custom UITableViewCell : Iphone Noob on September 26th, 2008 8:03 am

    [...] sure you have JSON Framework installed [...]

  6. UIImageView in a custom cell : Iphone Noob on September 26th, 2008 8:04 am

    [...] sure you have JSON Framework installed [...]

  7. Post JSON to a webservice : Iphone Noob on September 26th, 2008 8:04 am

    [...] sure you have JSON Framework installed [...]

  8. Using threads for a JSON request : Iphone Noob on September 26th, 2008 8:04 am

    [...] sure you have JSON Framework installed [...]

  9. Click a Cell : Iphone Noob on September 26th, 2008 8:06 am

    [...] sure you have JSON Framework installed [...]

  10. David Widman on October 1st, 2008 9:34 pm

    Hello,

    I can’t make the JSON sdk run with SDK 2.1. I keep getting the following error: JSON/JSON.h: No such file or directory. When I open your project, it works. I checked extensively the “Additional SDKs” and the “Other Linker Flags” and they are exactly the same as your project. Please HELP HELP HELP.

    David

  11. View Images like Photos.app : Iphone Noob on October 8th, 2008 9:17 am

    [...] sure you have JSON Framework installed [...]

  12. The LeVous on delicious iPhone links | Rusty's Technology Blog on October 14th, 2008 9:59 pm

    [...] experience with the iPhone Xml parser.  Its germane and, frankly, annoying.  Here’s how to install JSON for the iPhone. and here’s how to use JSON for the iPhone.Got it, Keep itNow that we’ve retrieved our [...]

  13. Levous on November 22nd, 2008 7:29 pm

    I just started using google toolkit for mac, including unit testing framework. When I build using the unit test target (set up according to their tut), the Json framework is not linking and the selectors are unrecognized.

    Any idea what I need to do so that json framework loads into testing context?

  14. Levous on November 24th, 2008 3:30 pm

    Got this resolved! I had failed to add “Other Linker Flags” to the “Unit Test” target. You have to set up the Unit Test target separately from your main app target and associate the same links. Works like a CHARM!

  15. iPhone Software » FrameWork para manejar ficheros con formato JSON on December 15th, 2008 2:36 pm

    [...] opción nos la proporciona la inclusión de un interesante FrameWork en nuestro proyecto, mediante el cual podemos volcar todo el contenido de dicho fichero o [...]

  16. Andy Atkinson on January 27th, 2009 2:38 am

    Hello, I have added the JSON.framework to ~/Library/Frameworks, added the parts to “Additional SDKs” and “Other Linked Flags” mentioned here, and still can’t compile code that includes the JSON framework. I completed the instructions here in comments as well, trying to create another target, as well as the instructions in the INSTALL of the DMG download. I am on Xcode 2.2.2 and running latest Leopard. Any more help please?

  17. Andy Atkinson on January 27th, 2009 10:58 am

    Whoops make that Xcode 3.1.1

  18. Felix on January 28th, 2009 10:54 am

    I also had problems getting this to work in XCode 3.1.1, until I changed

    $HOME/Library/SDKs/JSON/$(PLATFORM_NAME).sdk

    to

    $HOME/Library/SDKs/JSON/$(PLATFORM_NAME).sdk/

    Also, I copied the JSON folder into place from the command line, since Finder was tricking me with the file locations somehow.

    Hope it helps.

  19. Felix on January 28th, 2009 11:00 am

    Hmm… However, I did *not* have to make that change in order to compile the testjson project in the next post. Does anyone have a clue why this should be?

  20. From Out of Nowhere » JSON on the iPhone, Swing and a Miss on March 5th, 2009 2:23 am

    [...] found this JSON framework written in Objective-C. I wasn’t able to get as I had some weird build errors after following the installation [...]

Leave a Reply