JsonValue
Description
- Derived from
Represents a mutable JSON value.
A formatted JSON value must be written in the following Grammar:
json := value ; array := '[' (value .. ',')? ']' ; member := string ':' value ; object := '{' (comment* member .. ',')? '}' ; value := 'false' | 'null' | 'true' | object | array | number | string ; string := '"' (]"\\[ \ '\0'..'\x001F' | escape)* '"' ; escape := '\\' ([/tfbn"r\\] | 'u' hexdigit[4]) ; hexdigit := 'a'..'f' | 'A'..'F' | digit ; number := '-'? ('0' | '1'..'9' digit*) ('.' digit+)? (('e' | 'E') ('+' | '-')? digit+)? ; comment := '// ' ]\r\n[* '\r'? '\n' ; digit := '0'..'9' ;
The following methods may be used to set the value, changing the value type:
The following methods may be used to build array values, changing the value type to array
:
The following methods may be used to build object values, changing the value type to object
:
The IJsonValue interface may be used to pass around read-only references to JsonValue objects.
Public / Constants
Empty
The JSON value for the empty string.
This is not a singleton value, there may be other JsonValue objects that are equal to this one.
- See also
False
The false
JSON value.
This is not a singleton value, there may be other JsonValue objects that are equal to this one.
- See also
Null
The null
JSON value.
This is not a singleton value, there may be other JsonValue objects that are equal to this one.
- See also
True
The true
JSON value.
This is not a singleton value, there may be other JsonValue objects that are equal to this one.
- See also
Public / Constructors
From
Creates a JsonValue from the given text.
- ValidatingException
-
If the given source code text in is malformed.
- See also
FromFile
Creates a JsonValue from the given file.
- IOException
-
If an I/O error has occurred.
- ValidatingException
-
If the given file in contains malformed source code.
- See also
Public / Methods
Element
6 overloads
Appends an array element value to this JSON value.
- See also
Appends an array element value to this JSON value.
- See also
Appends an array element value to this JSON value.
- See also
Appends an array element value to this JSON value.
- See also
Appends an array element value to this JSON value.
- See also
Appends an array element value to this JSON value.
- See also
ElementPrepare
Turns this JSON value into an array with elements.
This method may be used when building a JSON array from a known number of elements, in order to make sure that the underlying collection has the optimal capacity.
- See also
Member
6 overloads
Sets an object member of this JSON value.
- See also
Sets an object member of this JSON value.
- See also
Sets an object member of this JSON value.
- See also
Sets an object member of this JSON value.
- See also
Sets an object member of this JSON value.
- See also
Sets an object member of this JSON value.
- See also
MemberPrepare
Turns this JSON value into an object with members.
This method may be used when building a JSON object from a known number of members, in order to make sure that the underlying collection has the optimal capacity.
- See also
Set
6 overloads
Sets the value of this JSON value to null
.
- See also
Sets the value of this JSON value.
- See also
Sets the value of this JSON value.
- See also
Sets the value of this JSON value.
- See also
Sets the value of this JSON value.
The JSON specification does not include infinity or not-a-number. These will be replaced as follows:
- See also
Sets the value of this JSON value.
- See also
Trim
Trims the capacity of the member list resp. element array to the actual number of items.
This method can be used after building a JsonValue and before passing it around as a read-only IJsonValue, in order to make sure that no memory is wasted in the underlying collections.