I am proud to present version 2.2 of JSON.framework, the strict JSON parser/generator for Cocoa and the iPhone. You can get the latest version from the download page.
Here are the more significant changes from the 2.1 series:
- 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
-proxyForJsonmethod 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
maxDepthsetting 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.
