Table of Contents

Interface JsonData

Namespace
PAC.Json

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 JsonData
jsonData2 JsonData
floatTolerance float

A tolerance (inclusive) to allow close floats to be considered equal.

Returns

bool

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 TextReader
mustReadAll bool

If 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

JsonData

Parse(string)

Attempts to parse the string as JsonData.

public static JsonData Parse(string str)

Parameters

str string

Returns

JsonData

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

str string
index int

Returns

JsonData

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 TextReader
mustReadAll bool

If 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

JsonData

ParseNumber(string)

Attempts to parse the string into a JsonData.Int or JsonData.Float.

public static JsonData ParseNumber(string str)

Parameters

str string

Returns

JsonData

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

str string
index int

Returns

JsonData

ToJsonString(bool)

Converts it into a string in JSON format.

string ToJsonString(bool pretty)

Parameters

pretty bool

If true, puts the string into pretty form - e.g. with indentations.

Returns

string