C# 클래스 Extensions.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. Pulled from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
파일 보기 프로젝트 열기: h07r0d/Netduino-Aquarium-Controller

공개 메소드들

메소드 설명
JsonDecode ( string json ) : object

Parses the string json into a value

JsonDecode ( string json, bool &success ) : object

Parses the string json into a value; and fills 'success' with the successfullness of the parse.

JsonDecodeConfig ( string configFile ) : object
JsonDecodeFromFile ( string file ) : object
JsonDecodeFromVar ( string file ) : object

Decodes a JSON string stored in a text file. Assumes the string is defined as a JS variable.

JsonEncode ( object json ) : string

Converts a Hashtable / ArrayList object into a JSON string

보호된 메소드들

메소드 설명
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, bool &success ) : ArrayList
ParseNumber ( char json, int &index, bool &success ) : double
ParseObject ( char json, int &index, bool &success ) : Hashtable
ParseString ( char json, int &index, bool &success ) : string
ParseValue ( char json, int &index, bool &success ) : object
SerializeArray ( ArrayList anArray, StringBuilder builder ) : bool
SerializeNumber ( double number, StringBuilder builder ) : bool
SerializeObject ( Hashtable anObject, StringBuilder builder ) : bool
SerializeString ( string aString, StringBuilder builder ) : bool
SerializeValue ( object value, StringBuilder builder ) : bool

메소드 상세

EatWhitespace() 보호된 정적인 메소드

protected static EatWhitespace ( char json, int &index ) : void
json char
index int
리턴 void

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

JsonDecode() 공개 정적인 메소드

Parses the string json into a value; and fills 'success' with the successfullness of the parse.
public static JsonDecode ( string json, bool &success ) : object
json string A JSON string.
success bool Successful parse?
리턴 object

JsonDecodeConfig() 공개 정적인 메소드

public static JsonDecodeConfig ( string configFile ) : object
configFile string
리턴 object

JsonDecodeFromFile() 공개 정적인 메소드

public static JsonDecodeFromFile ( string file ) : object
file string
리턴 object

JsonDecodeFromVar() 공개 정적인 메소드

Decodes a JSON string stored in a text file. Assumes the string is defined as a JS variable.
public static JsonDecodeFromVar ( string file ) : object
file string File to open for decoding
리턴 object

JsonEncode() 공개 정적인 메소드

Converts a Hashtable / ArrayList object into a JSON string
public static JsonEncode ( object json ) : string
json object A Hashtable / ArrayList
리턴 string

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, bool &success ) : ArrayList
json char
index int
success bool
리턴 System.Collections.ArrayList

ParseNumber() 보호된 정적인 메소드

protected static ParseNumber ( char json, int &index, bool &success ) : double
json char
index int
success bool
리턴 double

ParseObject() 보호된 정적인 메소드

protected static ParseObject ( char json, int &index, bool &success ) : Hashtable
json char
index int
success bool
리턴 System.Collections.Hashtable

ParseString() 보호된 정적인 메소드

protected static ParseString ( char json, int &index, bool &success ) : string
json char
index int
success bool
리턴 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 System.Collections.ArrayList
builder StringBuilder
리턴 bool

SerializeNumber() 보호된 정적인 메소드

protected static SerializeNumber ( double number, StringBuilder builder ) : bool
number double
builder StringBuilder
리턴 bool

SerializeObject() 보호된 정적인 메소드

protected static SerializeObject ( Hashtable anObject, StringBuilder builder ) : bool
anObject System.Collections.Hashtable
builder StringBuilder
리턴 bool

SerializeString() 보호된 정적인 메소드

protected static SerializeString ( string aString, StringBuilder builder ) : bool
aString string
builder StringBuilder
리턴 bool

SerializeValue() 보호된 정적인 메소드

protected static SerializeValue ( object value, StringBuilder builder ) : bool
value object
builder StringBuilder
리턴 bool