C# Класс Playtomic.JSON

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 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
IsNumeric ( object o ) : bool

Determines if a given object is numeric in any way (can be integer, double, etc). C# has no pretty way to do this.

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
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 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 GetLastIndexOfNumber ( char json, int index ) : int
json char
index int
Результат int

IsNumeric() защищенный Метод

Determines if a given object is numeric in any way (can be integer, double, etc). C# has no pretty way to do this.
protected IsNumeric ( object o ) : bool
o object
Результат bool

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 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 LookAhead ( char json, int index ) : int
json char
index int
Результат int

NextToken() защищенный Метод

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

ParseArray() защищенный Метод

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

ParseNumber() защищенный Метод

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

ParseObject() защищенный Метод

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

ParseString() защищенный Метод

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

ParseValue() защищенный Метод

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

SerializeArray() защищенный Метод

protected SerializeArray ( ArrayList anArray, StringBuilder builder ) : bool
anArray System.Collections.ArrayList
builder StringBuilder
Результат bool

SerializeNumber() защищенный Метод

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

SerializeObject() защищенный Метод

protected SerializeObject ( Hashtable anObject, StringBuilder builder ) : bool
anObject System.Collections.Hashtable
builder StringBuilder
Результат bool

SerializeObjectOrArray() защищенный Метод

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

SerializeString() защищенный Метод

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

SerializeValue() защищенный Метод

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

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

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

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

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

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