Simple IAP System  5.0
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
MiniJson

This class encodes and decodes JSON strings. Spec. details, see http://www.json.org/ More...

Static Public Member Functions

static object JsonDecode (string json)
 Parses the string json into a value More...
 
static string JsonEncode (System.Object json)
 Converts a Hashtable / ArrayList / Dictionary(string,string) object into a JSON string More...
 
static bool lastDecodeSuccessful ()
 On decoding, this function returns the position at which the parse failed (-1 = no error). More...
 
static int getLastErrorIndex ()
 On decoding, this function returns the position at which the parse failed (-1 = no error). More...
 
static string getLastErrorSnippet ()
 If a decoding error occurred, this function returns a piece of the JSON string at which the error took place. To ease debugging. More...
 

Static Protected Member Functions

static Hashtable parseObject (char[] json, ref int index)
 
static ArrayList parseArray (char[] json, ref int index)
 
static System.Object parseValue (char[] json, ref int index, ref bool success)
 
static string parseString (char[] json, ref int index)
 
static double parseNumber (char[] json, ref int index)
 
static int getLastIndexOfNumber (char[] json, int index)
 
static void eatWhitespace (char[] json, ref int index)
 
static int lookAhead (char[] json, int index)
 
static int nextToken (char[] json, ref int index)
 
static bool serializeObjectOrArray (System.Object objectOrArray, StringBuilder builder)
 
static bool serializeObject (Hashtable anObject, StringBuilder builder)
 
static bool serializeDictionary (Dictionary< string, string > dict, StringBuilder builder)
 
static bool serializeArray (ArrayList anArray, StringBuilder builder)
 
static bool serializeValue (System.Object value, StringBuilder builder)
 
static void serializeString (string aString, StringBuilder builder)
 
static void serializeNumber (double number, StringBuilder builder)
 

Static Protected Attributes

static int lastErrorIndex = -1
 On decoding, this value holds the position at which the parse failed (-1 = no error). More...
 
static string lastDecode = ""
 

Detailed Description

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.

Member Function Documentation

static void eatWhitespace ( char[]  json,
ref int  index 
)
staticprotected
static int getLastErrorIndex ( )
static

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

Returns
static string getLastErrorSnippet ( )
static

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

Returns
static int getLastIndexOfNumber ( char[]  json,
int  index 
)
staticprotected
static object JsonDecode ( string  json)
static

Parses the string json into a value

Parameters
jsonA JSON string.
Returns
An ArrayList, a Hashtable, a double, a string, null, true, or false
static string JsonEncode ( System.Object  json)
static

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

Parameters
jsonA Hashtable / ArrayList
Returns
A JSON encoded string, or null if object 'json' is not serializable
static bool lastDecodeSuccessful ( )
static

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

Returns
static int lookAhead ( char[]  json,
int  index 
)
staticprotected
static int nextToken ( char[]  json,
ref int  index 
)
staticprotected
static ArrayList parseArray ( char[]  json,
ref int  index 
)
staticprotected
static double parseNumber ( char[]  json,
ref int  index 
)
staticprotected
static Hashtable parseObject ( char[]  json,
ref int  index 
)
staticprotected
static string parseString ( char[]  json,
ref int  index 
)
staticprotected
static System.Object parseValue ( char[]  json,
ref int  index,
ref bool  success 
)
staticprotected
static bool serializeArray ( ArrayList  anArray,
StringBuilder  builder 
)
staticprotected
static bool serializeDictionary ( Dictionary< string, string >  dict,
StringBuilder  builder 
)
staticprotected
static void serializeNumber ( double  number,
StringBuilder  builder 
)
staticprotected
static bool serializeObject ( Hashtable  anObject,
StringBuilder  builder 
)
staticprotected
static bool serializeObjectOrArray ( System.Object  objectOrArray,
StringBuilder  builder 
)
staticprotected
static void serializeString ( string  aString,
StringBuilder  builder 
)
staticprotected
static bool serializeValue ( System.Object  value,
StringBuilder  builder 
)
staticprotected

Member Data Documentation

string lastDecode = ""
staticprotected
int lastErrorIndex = -1
staticprotected

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


The documentation for this class was generated from the following file: