Stig Brautaset has released version 2.2 of the very popular JSON.framework for Cocoa and the iPhone. You can grab the .dmg or visit the project home over at Google Code.
Here is the list of significant changes compared to version 2.1, copied 1:1 for your reading convenience courtesy of Stig’s blog post:
New, fresh API—particularly for errors
Extracted the SBJsonWriter and SBJsonParser classes from the SBJSON class. These present a fresh, simple API. If a method returns nil, you can now simply call a method to get an array of NSError objects containing the error trace.
The SBJSON class is now a facade, implementing its old interface by forwarding messages to instances of the new classes. Additionally, the facade also implements the new simplified interface of the SBJsonWriter and SBJsonParser classes.
The category methods on Foundation objects have also been re-implemented more efficiently in terms of the new objects. In case of error in these methods now print the full trace to the log, rather than just the top-level error.
Support for JSON representation of custom objects
If you implement the -proxyForJson method in a custom class (either directly or as category) this now enables JSON.framework to create a JSON representation for objects of that type. See the ProxyTest.m file for more information on how this works.
Deprecated fragment-based methods
The fragment-based methods are an extension to the JSON spec that does not belong in a strict JSON parser/generator. They were originally implemented to ease testing, but the tests should rather be rewritten not to need them. For the time being they are still included, but will be removed in the 2.3.x line.
Updated the iPhone SDK
The iPhone SDK has had some updates to address problems some people were seeing. It has been updated to be based on iPhoneOS v2.2.1.
Fix crash on recursive structures
Implemented the maxDepth setting for writing JSON. This defaults to 512 and means the framework won’t crash if its is fed a recursive (or extremely deeply nested) structure.
Documentation updates
Simplified the installation instructions, particularly for the iPhone.
In the API documentation classes now inherit documentation from their superclasses and the protocols they implement.
Miscellaneous
Fixed some warnings reported by the Clang static analyser. Added a Changes file and updated the Credits.
Check it out!
If you want to check out the source code from the SVN repository, here’s the shell command:
svn checkout http://json-framework.googlecode.com/svn/trunk/ json-framework-read-only

{ 1 trackback }
{ 2 comments… read them below or add one }
Would it be updated for iPhoneOS 3.0 soon?
Thanks
Yoichi
JSON Framework 2.2 for iPhone (and Cocoa) released: http://bit.ly/t0QPf
This comment was originally posted on Twitter