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   := '"' (no-chars+ | escape)* '"' ;
escape   := '\\' (["/\\bfnrt] | 'u' hexdigit[4]) ;
hexdigit := 'a'..'f' | 'A'..'F' | digit ;
number   := '-'? ('0' | '1'..'9' digit*) ('.' digit+)? (('e' | 'E') ('+' | '-')? digit+)? ;
comment  := '//' ' '? ]\n\r[* '\r'? '\n' ;
digit    := '0'..'9' ;
no-chars := ]\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0B\x0C\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"\\[ ;
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
2 overloads
Creates a JsonValue from the given text.
- ValidatingException
- 
If the given source code text in is malformed. 
- See also
Creates a new instance of JsonValue.
FromFile
Creates a JsonValue from the given file.
The given file in is expected to be in UTF-8 encoding, without BOM.
- 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.