C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
lastDecode string
lastErrorIndex int

Открытые методы

Метод Описание
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).

Защищенные методы

Метод Описание
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

Описание методов

eatWhitespace() защищенный статический Метод

protected static eatWhitespace ( char json, int &index ) : void
json char
index int
Результат void

getLastErrorIndex() публичный статический Метод

On decoding, this function returns the position at which the parse failed (-1 = no error).
public static getLastErrorIndex ( ) : int
Результат int

getLastErrorSnippet() публичный статический Метод

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
Результат string

getLastIndexOfNumber() защищенный статический Метод

protected static getLastIndexOfNumber ( char json, int index ) : int
json char
index int
Результат int

jsonDecode() публичный статический Метод

Parses the string json into a value
public static jsonDecode ( string json ) : object
json string A JSON string.
Результат object

jsonEncode() публичный статический Метод

Converts a Hashtable / ArrayList / Dictionary(string,string) object into a JSON string
public static jsonEncode ( object json ) : string
json object A Hashtable / ArrayList
Результат string

lastDecodeSuccessful() публичный статический Метод

On decoding, this function returns the position at which the parse failed (-1 = no error).
public static lastDecodeSuccessful ( ) : bool
Результат bool

lookAhead() защищенный статический Метод

protected static lookAhead ( char json, int index ) : int
json char
index int
Результат int

nextToken() защищенный статический Метод

protected static nextToken ( char json, int &index ) : int
json char
index int
Результат int

parseArray() защищенный статический Метод

protected static parseArray ( char json, int &index ) : ArrayList
json char
index int
Результат System.Collections.ArrayList

parseNumber() защищенный статический Метод

protected static parseNumber ( char json, int &index ) : double
json char
index int
Результат double

parseObject() защищенный статический Метод

protected static parseObject ( char json, int &index ) : Hashtable
json char
index int
Результат Hashtable

parseString() защищенный статический Метод

protected static parseString ( char json, int &index ) : string
json char
index int
Результат string

parseValue() защищенный статический Метод

protected static parseValue ( char json, int &index, bool &success ) : object
json char
index int
success bool
Результат object

serializeArray() защищенный статический Метод

protected static serializeArray ( ArrayList anArray, StringBuilder builder ) : bool
anArray ArrayList
builder StringBuilder
Результат bool

serializeDictionary() защищенный статический Метод

protected static serializeDictionary ( string>.Dictionary dict, StringBuilder builder ) : bool
dict string>.Dictionary
builder StringBuilder
Результат bool

serializeNumber() защищенный статический Метод

protected static serializeNumber ( double number, StringBuilder builder ) : void
number double
builder StringBuilder
Результат void

serializeObject() защищенный статический Метод

protected static serializeObject ( Hashtable anObject, StringBuilder builder ) : bool
anObject Hashtable
builder StringBuilder
Результат bool

serializeObjectOrArray() защищенный статический Метод

protected static serializeObjectOrArray ( object objectOrArray, StringBuilder builder ) : bool
objectOrArray object
builder StringBuilder
Результат bool

serializeString() защищенный статический Метод

protected static serializeString ( string aString, StringBuilder builder ) : void
aString string
builder StringBuilder
Результат void

serializeValue() защищенный статический Метод

protected static serializeValue ( object value, StringBuilder builder ) : bool
value object
builder StringBuilder
Результат bool

Описание свойств

lastDecode защищенное статическое свойство

protected static string lastDecode
Результат string

lastErrorIndex защищенное статическое свойство

On decoding, this value holds the position at which the parse failed (-1 = no error).
protected static int lastErrorIndex
Результат int