SBJsonParser Class Reference

The JSON parser class. More...

Inheritance diagram for SBJsonParser:

SBJsonBase < SBJsonParser >

List of all members.

Public Member Functions

(id) - objectWithString:
 Return the object represented by the given string.

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.


Detailed Description

JSON is mapped to Objective-C types in the following way:

Since Objective-C doesn't have a dedicated class for boolean values, these turns into NSNumber instances. These are initialised with the -initWithBool: method, and round-trip back to JSON properly. (They won't silently suddenly become 0 or 1; they'll be represented as 'true' and 'false' again.)

JSON numbers turn into NSDecimalNumber instances, as we can thus avoid any loss of precision. (JSON allows ridiculously large numbers.)


Member Function Documentation

- (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.

Parameters:
repr the json string to parse


Property Documentation

- (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.

- (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.


The documentation for this class was generated from the following file:

Generated on Sun Mar 7 15:41:17 2010 by  doxygen 1.5.9