C# Class FistBump.Framework.MiniJSON

This class encodes and decodes JSON strings. Spec. details, see http://www.json.org/ JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable. All numbers are parsed to doubles.
Afficher le fichier Open project: fistbump/framework Class Usage Examples

Protected Properties

Свойство Type Description
lastDecode string
lastErrorIndex int

Méthodes publiques

Méthode 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).

Méthodes protégées

Méthode 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 méthode

protected static eatWhitespace ( char json, int &index ) : void
json char
index int
Résultat void

getLastErrorIndex() public static méthode

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

getLastErrorSnippet() public static méthode

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
Résultat string

getLastIndexOfNumber() protected static méthode

protected static getLastIndexOfNumber ( char json, int index ) : int
json char
index int
Résultat int

jsonDecode() public static méthode

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

jsonEncode() public static méthode

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

lastDecodeSuccessful() public static méthode

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

lookAhead() protected static méthode

protected static lookAhead ( char json, int index ) : int
json char
index int
Résultat int

nextToken() protected static méthode

protected static nextToken ( char json, int &index ) : int
json char
index int
Résultat int

parseArray() protected static méthode

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

parseNumber() protected static méthode

protected static parseNumber ( char json, int &index ) : double
json char
index int
Résultat double

parseObject() protected static méthode

protected static parseObject ( char json, int &index ) : Hashtable
json char
index int
Résultat Hashtable

parseString() protected static méthode

protected static parseString ( char json, int &index ) : string
json char
index int
Résultat string

parseValue() protected static méthode

protected static parseValue ( char json, int &index, bool &success ) : object
json char
index int
success bool
Résultat object

serializeArray() protected static méthode

protected static serializeArray ( ArrayList anArray, StringBuilder builder ) : bool
anArray ArrayList
builder StringBuilder
Résultat bool

serializeDictionary() protected static méthode

protected static serializeDictionary ( string>.Dictionary dict, StringBuilder builder ) : bool
dict string>.Dictionary
builder StringBuilder
Résultat bool

serializeNumber() protected static méthode

protected static serializeNumber ( double number, StringBuilder builder ) : void
number double
builder StringBuilder
Résultat void

serializeObject() protected static méthode

protected static serializeObject ( Hashtable anObject, StringBuilder builder ) : bool
anObject Hashtable
builder StringBuilder
Résultat bool

serializeObjectOrArray() protected static méthode

protected static serializeObjectOrArray ( object objectOrArray, StringBuilder builder ) : bool
objectOrArray object
builder StringBuilder
Résultat bool

serializeString() protected static méthode

protected static serializeString ( string aString, StringBuilder builder ) : void
aString string
builder StringBuilder
Résultat void

serializeValue() protected static méthode

protected static serializeValue ( object value, StringBuilder builder ) : bool
value object
builder StringBuilder
Résultat bool

Property Details

lastDecode protected_oe static_oe property

protected static string lastDecode
Résultat string

lastErrorIndex protected_oe static_oe property

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