This project is no longer maintained.
Encode / Decode JSON By Any Means Possible
AnyJSON implements the NSJSONSerialization
API
for platforms that don't support it ---
namely iOS < 5 and Mac OS X < 10.7 ---
using the first available of the following 3rd-party libraries:
For anyone who appreciates lower-level Objective-C hacks, you won't want to miss how AnyJSON works its magic.
The following methods are supported by AnyJSON:
+ (id)JSONObjectWithData:(NSData *)data
options:(NSJSONReadingOptions)opt
error:(NSError **)error
+ (NSData *)dataWithJSONObject:(id)obj
options:(NSJSONWritingOptions)opt
error:(NSError **)error
NSJSONReadingMutableContainers
is supported only by JSONKitNSJSONReadingMutableLeaves
is not supported (it doesn't even work withNSJSONSerialization
on iOS 5+).NSJSONReadingAllowFragments
is not supported, though NextiveJSON always allows fragments
NSJSONWritingPrettyPrinted
is supported by JSONKit, yajl_json, and SBJSON
The following methods are not currently supported by AnyJSON,
and instead throw an AnyJSONUnimplementedException
exception when called:
+ (id)JSONObjectWithStream:(NSInputStream *)stream
options:(NSJSONReadingOptions)opt
error:(NSError **)error
+ (NSInteger)writeJSONObject:(id)obj
toStream:(NSOutputStream *)stream
options:(NSJSONWritingOptions)opt
error:(NSError **)error
+ (BOOL)isValidJSONObject:(id)obj
AnyJSON is available under the MIT license. See the LICENSE file for more info.