C# Class XUtil.MiniJSON

Show file Open project: sunduk/freegostop

Protected Properties

Property Type Description
lastDecode string
lastErrorIndex int

Public Methods

Method Description
getLastErrorIndex ( ) : int

On decoding, this function returns the position at which the parse failed (-1 = no error).

getLastErrorSnippet ( ) : string

If a decoding error occurred, this function returns a piece of the JSON string at which the error took place. To ease debugging.

jsonDecode ( string json ) : object

Parses the string json into a value

jsonEncode ( object json ) : string

Converts a Hashtable / ArrayList / Dictionary(string,string) object into a JSON string

lastDecodeSuccessful ( ) : bool

On decoding, this function returns the position at which the parse failed (-1 = no error).

Protected Methods

Method Description
eatWhitespace ( char json, int &index ) : void
getLastIndexOfNumber ( char json, int index ) : int
lookAhead ( char json, int index ) : int
nextToken ( char json, int &index ) : int
parseArray ( char json, int &index ) : ArrayList
parseNumber ( char json, int &index ) : double
parseObject ( char json, int &index ) : Hashtable
parseString ( char json, int &index ) : string
parseValue ( char json, int &index, bool &success ) : object
serializeArray ( ArrayList anArray, StringBuilder builder ) : bool
serializeDictionary ( string>.Dictionary dict, StringBuilder builder ) : bool
serializeNumber ( double number, StringBuilder builder ) : void
serializeObject ( Hashtable anObject, StringBuilder builder ) : bool
serializeObjectOrArray ( object objectOrArray, StringBuilder builder ) : bool
serializeString ( string aString, StringBuilder builder ) : void
serializeValue ( object value, StringBuilder builder ) : bool

Method Details

eatWhitespace() protected static method

protected static eatWhitespace ( char json, int &index ) : void
json char
index int
return void

getLastErrorIndex() public static method

On decoding, this function returns the position at which the parse failed (-1 = no error).
public static getLastErrorIndex ( ) : int
return int

getLastErrorSnippet() public static method

If a decoding error occurred, this function returns a piece of the JSON string at which the error took place. To ease debugging.
public static getLastErrorSnippet ( ) : string
return string

getLastIndexOfNumber() protected static method

protected static getLastIndexOfNumber ( char json, int index ) : int
json char
index int
return int

jsonDecode() public static method

Parses the string json into a value
public static jsonDecode ( string json ) : object
json string A JSON string.
return object

jsonEncode() public static method

Converts a Hashtable / ArrayList / Dictionary(string,string) object into a JSON string
public static jsonEncode ( object json ) : string
json object A Hashtable / ArrayList
return string

lastDecodeSuccessful() public static method

On decoding, this function returns the position at which the parse failed (-1 = no error).
public static lastDecodeSuccessful ( ) : bool
return bool

lookAhead() protected static method

protected static lookAhead ( char json, int index ) : int
json char
index int
return int

nextToken() protected static method

protected static nextToken ( char json, int &index ) : int
json char
index int
return int

parseArray() protected static method

protected static parseArray ( char json, int &index ) : ArrayList
json char
index int
return System.Collections.ArrayList

parseNumber() protected static method

protected static parseNumber ( char json, int &index ) : double
json char
index int
return double

parseObject() protected static method

protected static parseObject ( char json, int &index ) : Hashtable
json char
index int
return System.Collections.Hashtable

parseString() protected static method

protected static parseString ( char json, int &index ) : string
json char
index int
return string

parseValue() protected static method

protected static parseValue ( char json, int &index, bool &success ) : object
json char
index int
success bool
return object

serializeArray() protected static method

protected static serializeArray ( ArrayList anArray, StringBuilder builder ) : bool
anArray System.Collections.ArrayList
builder StringBuilder
return bool

serializeDictionary() protected static method

protected static serializeDictionary ( string>.Dictionary dict, StringBuilder builder ) : bool
dict string>.Dictionary
builder StringBuilder
return bool

serializeNumber() protected static method

protected static serializeNumber ( double number, StringBuilder builder ) : void
number double
builder StringBuilder
return void

serializeObject() protected static method

protected static serializeObject ( Hashtable anObject, StringBuilder builder ) : bool
anObject System.Collections.Hashtable
builder StringBuilder
return bool

serializeObjectOrArray() protected static method

protected static serializeObjectOrArray ( object objectOrArray, StringBuilder builder ) : bool
objectOrArray object
builder StringBuilder
return bool

serializeString() protected static method

protected static serializeString ( string aString, StringBuilder builder ) : void
aString string
builder StringBuilder
return void

serializeValue() protected static method

protected static serializeValue ( object value, StringBuilder builder ) : bool
value object
builder StringBuilder
return bool

Property Details

lastDecode protected static property

protected static string lastDecode
return string

lastErrorIndex protected static property

On decoding, this value holds the position at which the parse failed (-1 = no error).
protected static int lastErrorIndex
return int