Interface JsonData
Represents a piece of JSON data.
public interface JsonData
Methods
HaveSameData(JsonData, JsonData, float)
Returns whether the two pieces of JSON data are equal by value rather than whether they point to the same JsonData object.
public static bool HaveSameData(JsonData jsonData1, JsonData jsonData2, float floatTolerance = 0)
Parameters
jsonData1
JsonDatajsonData2
JsonDatafloatTolerance
floatA tolerance (inclusive) to allow close floats to be considered equal.
Returns
Parse(TextReader, bool)
Reads the TextReader, starting at the given index, and attempts to parse it as JsonData. If successful, the last read character will be the last character of the parsed JSON.
public static JsonData Parse(TextReader reader, bool mustReadAll)
Parameters
reader
TextReadermustReadAll
boolIf true, it will check that all the data in the reader was used when parsing. Setting this to false is useful for parsing JSON data inside a list or object.
Returns
Parse(string)
Attempts to parse the string as JsonData.
public static JsonData Parse(string str)
Parameters
str
string
Returns
Parse(string, ref int)
Reads the string, starting at the given index, and attempts to parse the string as JsonData. If successful, the index will be moved to the last character of the data.
public static JsonData Parse(string str, ref int index)
Parameters
Returns
ParseNumber(TextReader, bool)
Reads the TextReader, starting at the given index, and attempts to parse it as a JsonData.Int or JsonData.Float. If successful, the last read character will be the last character of the parsed JSON.
public static JsonData ParseNumber(TextReader reader, bool mustReadAll)
Parameters
reader
TextReadermustReadAll
boolIf true, it will check that all the data in the reader was used when parsing. Setting this to false is useful for parsing JSON data inside a list or object.
Returns
ParseNumber(string)
Attempts to parse the string into a JsonData.Int or JsonData.Float.
public static JsonData ParseNumber(string str)
Parameters
str
string
Returns
ParseNumber(string, ref int)
Reads the string, starting at the given index, and attempts to parse the string as a JsonData.Int or JsonData.Float. If successful, the index will be moved to the last digit of the number.
public static JsonData ParseNumber(string str, ref int index)
Parameters
Returns
ToJsonString(bool)
Converts it into a string in JSON format.
string ToJsonString(bool pretty)
Parameters
pretty
boolIf true, puts the string into pretty form - e.g. with indentations.