Public Member Functions | |
(id) | - fragmentWithString:error: |
Return the fragment represented by the given string. | |
(id) | - objectWithString:error: |
Return the object represented by the given string. | |
(id) | - objectWithString:allowScalar:error: |
Parse the string and return the represented object (or scalar). | |
(NSString *) | - stringWithObject:error: |
Return JSON representation of an array or dictionary. | |
(NSString *) | - stringWithFragment:error: |
Return JSON representation of any legal JSON value. | |
(NSString *) | - stringWithObject:allowScalar:error: |
Return JSON representation (or fragment) for the given object. | |
(id) | - objectWithString: |
Return the object represented by the given string. | |
(NSString *) | - stringWithObject: |
Return JSON representation (or fragment) for the given object. | |
Properties | |
NSArray * | errorTrace |
Return an error trace, or nil if there was no errors. | |
NSUInteger | maxDepth |
The maximum recursing depth. | |
NSUInteger | maxDepth |
The maximum recursing depth. | |
BOOL | humanReadable |
Whether we are generating human-readable (multiline) JSON. | |
BOOL | sortKeys |
Whether or not to sort the dictionary keys in the output. |
- (id) fragmentWithString: | (NSString*) | repr | ||
error: | (NSError**) | error | ||
Returns the object represented by the passed-in string or nil on error. The returned object can be a string, number, boolean, null, array or dictionary.
repr | the json string to parse | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (id) objectWithString: | (NSString *) | repr |
Returns the object represented by the passed-in string or nil on error. The returned object can be a string, number, boolean, null, array or dictionary.
repr | the json string to parse |
- (id) objectWithString: | (id) | value | ||
allowScalar: | (BOOL) | allowScalar | ||
error: | (NSError**) | error | ||
Returns the object represented by the passed-in string or nil on error. The returned object can be a string, number, boolean, null, array or dictionary.
value | the json string to parse | |
allowScalar | whether to return objects for JSON fragments | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (id) objectWithString: | (NSString*) | repr | ||
error: | (NSError**) | error | ||
Returns the object represented by the passed-in string or nil on error. The returned object will be either a dictionary or an array.
repr | the json string to parse | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (NSString *) stringWithFragment: | (id) | value | ||
error: | (NSError**) | error | ||
Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and error
is not NULL, error
can be interrogated to find the cause of the error.
value | any instance that can be represented as a JSON fragment | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (NSString*) stringWithObject: | (id) | value |
Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and error
is not NULL, *error
can be interrogated to find the cause of the error.
value | any instance that can be represented as a JSON fragment |
- (NSString *) stringWithObject: | (id) | value | ||
allowScalar: | (BOOL) | allowScalar | ||
error: | (NSError**) | error | ||
Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and error
is not NULL, *error
can be interrogated to find the cause of the error.
value | any instance that can be represented as a JSON fragment | |
allowScalar | wether to return json fragments for scalar objects | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (NSString *) stringWithObject: | (id) | value | ||
error: | (NSError**) | error | ||
Returns a string containing JSON representation of the passed in value, or nil on error. If nil is returned and error
is not NULL, error
can be interrogated to find the cause of the error.
value | a NSDictionary or NSArray instance | |
error | used to return an error by reference (pass NULL if this is not desired) |
- (NSArray*) errorTrace [read, copy, inherited] |
Note that this method returns the trace of the last method that failed. You need to check the return value of the call you're making to figure out if the call actually failed, before you know call this method.
- (BOOL) humanReadable [read, write, assign, inherited] |
Set whether or not to generate human-readable JSON. The default is NO, which produces JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable JSON with linebreaks after each array value and dictionary key/value pair, indented two spaces per nesting level.
- (NSUInteger) maxDepth [read, write, assign, inherited] |
Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0.
- (NSUInteger) maxDepth [read, write, assign, inherited] |
Defaults to 512. If the input is nested deeper than this the input will be deemed to be malicious and the parser returns nil, signalling an error. ("Nested too deep".) You can turn off this security feature by setting the maxDepth value to 0.
- (BOOL) sortKeys [read, write, assign, inherited] |
If this is set to YES, the dictionary keys in the JSON output will be in sorted order. (This is useful if you need to compare two structures, for example.) The default is NO.