Playlist Generator  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Public Member Functions | Properties
SBJsonParser Class Reference

Parse JSON Strings and NSData objects. More...

#import <SBJsonParser.h>

Inheritance diagram for SBJsonParser:
NSObject

List of all members.

Public Member Functions

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

Properties

NSUInteger maxDepth
 The maximum recursing depth.
NSStringerror
 Description of parse error.

Detailed Description

Parse JSON Strings and NSData objects.

This uses SBJsonStreamParser internally.

See also:
Objective-C to JSON

Member Function Documentation

- (id) objectWithData: (NSData*)  data

Return the object represented by the given NSData object.

The data must be UTF8 encoded.

Parameters:
dataAn NSData containing UTF8 encoded data to parse.
Returns:
The NSArray or NSDictionary represented by the object, or nil if an error occured.
- (id) objectWithString: (NSString *)  repr

Return the object represented by the given string.

This method converts its input to an NSData object containing UTF8 and calls -objectWithData: with it.

Returns:
The NSArray or NSDictionary represented by the object, or nil if an error occured.
- (id) objectWithString: (NSString*)  jsonText
error: (NSError**)  error 

Return the object represented by the given string.

This method calls objectWithString: internally. If an error occurs, and if error is not nil, it creates an NSError object and returns this through its second argument.

Parameters:
jsonTextthe json string to parse
errorpointer to an NSError object to populate on error
Returns:
The NSArray or NSDictionary represented by the object, or nil if an error occured.

Property Documentation

- (NSString*) error [read, write, copy]

Description of parse error.

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.

Returns:
A string describing the error encountered, or nil if no error occured.
- (NSUInteger) maxDepth [read, write, assign]

The maximum recursing depth.

Defaults to 32. 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 files: