Table of Contents

Class JsonData.String

Namespace
PAC.Json

Represents a non-null string in JSON data.

public class JsonData.String : JsonData
Inheritance
JsonData.String
Implements
Inherited Members

Constructors

String(string)

public String(string value)

Parameters

value string

Properties

value

public string value { get; set; }

Property Value

string

Methods

MaybeNull(string)

Creates a new JsonData.String with the given value, unless value is null in which case it returns JsonData.Null. Useful since JsonData.String cannot hold null strings.

public static JsonData MaybeNull(string value)

Parameters

value string

Returns

JsonData

Parse(TextReader, bool)

Reads the TextReader, starting at the given index, and attempts to parse it as a JsonData.String. If successful, the last read character will be the last character of the parsed JSON.

public static JsonData.String 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.String

Parse(string)

Attempts to parse the string into a JsonData.String.

public static JsonData.String Parse(string str)

Parameters

str string

Returns

JsonData.String

Parse(string, ref int)

Reads the string, starting at the given index, and attempts to parse the string as a JsonData.String. If successful, the index will be moved to the closing quotation mark.

public static JsonData.String Parse(string str, ref int index)

Parameters

str string
index int

Returns

JsonData.String

ParseMaybeNull(string)

Attempts to parse the string into a JSON string, with the potential to parse it into JsonData.Null.

public static JsonData ParseMaybeNull(string str)

Parameters

str string

Returns

JsonData

ParseMaybeNull(string, ref int)

Attempts to parse the string into a JSON string, with the potential to parse it into JsonData.Null. If successful, moves the index to the last parsed character.

public static JsonData ParseMaybeNull(string str, ref int index)

Parameters

str string
index int

Returns

JsonData

ToJsonString(bool)

Converts it into a string in JSON format.

public string ToJsonString(bool pretty)

Parameters

pretty bool

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

Returns

string

Operators

implicit operator string(String)

public static implicit operator string(JsonData.String jsonString)

Parameters

jsonString JsonData.String

Returns

string

implicit operator String(string)

public static implicit operator JsonData.String(string value)

Parameters

value string

Returns

JsonData.String