Struct Json
Represents a single JSON value.
Json
values can have one of the types defined in the Json.Type
enum. They behave mostly like values in ECMA script in the way that you can transparently perform operations on them. However, strict typechecking is done, so that operations between differently typed JSON values will throw an exception. Additionally, an explicit cast or using get
!() or to
!() is required to
convert a JSON value to
the corresponding static D type
.
Constructors
Name | Description |
---|---|
this | Constructor for a JSON object. |
Properties
Name | Type | Description |
---|---|---|
Undefined | Json | New JSON value of Type.Undefined |
EmptyObject | Json | New JSON value of Type.Object |
EmptyArray | Json | New JSON value of Type.Array |
type | Json.Type | The current type id of this JSON object. |
length | ulong | Returns the number of entries of string, array or object typed JSON values. |
Methods
Name | Description |
---|---|
opAssign | Allows assignment of D values to a JSON value. |
opIndex | Allows direct indexing of array typed JSON values. |
opIndex | Allows direct indexing of object typed JSON values using a string as the key . |
opSlice | Returns a slice of a JSON array. |
opSlice | |
opApply | Allows foreach iterating over JSON objects and arrays. |
opCast | Converts the JSON value to the corresponding D type - types must match exactly. |
get | Converts the JSON value to the corresponding D type - types must match exactly. |
opt | Converts the JSON value to the corresponding D type - types must match exactly. |
to | Converts the JSON value to the corresponding D type - types are converted as neccessary. |
opUnary | Performs unary operations on the JSON value. |
opBinary | Performs binary operations between JSON values. |
opOpAssign | Performs binary operations between JSON values. |
opBinary | Performs binary operations between JSON values. |
opBinaryRight | Performs binary operations between JSON values. |
opDispatch | Allows to access existing fields of a JSON object using dot syntax. |
opEquals | Compares two JSON values for equality. |
opCmp | Compares two JSON values. |
typeId | Returns the type id corresponding to the given D type . |
toString | Returns the JSON object as a string. |
toPrettyString | Returns the JSON object as a "pretty" string. |
checkType | |
__xopEquals |
Enums
Name | Description |
---|---|
Type | Represents the run time type of a JSON value. |
Authors
Sönke Ludwig
Copyright
© 2012 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.