Struct Json
Represents a single JSON value.
Json
values can have one of the types defined in the Json
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
a JSONException. 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 |
---|---|---|
emptyArray
[get]
|
Json |
New JSON value of Type
|
emptyObject
[get]
|
Json |
New JSON value of Type
|
get
[get]
|
inout(T) |
Converts the JSON value to the corresponding D type - types must match exactly.
|
length
[get]
|
ulong |
Returns the number of entries of string, array or object typed JSON values. |
opDispatch
[get]
|
const(Json) |
Deprecated, please use opIndex instead.
|
opt
[set]
|
const(T) |
Returns the native type for this JSON if it matches the current runtime type .
|
to
[get]
|
inout(T) |
Converts the JSON value to the corresponding D type - types are converted as necessary.
|
type
[get]
|
Json |
The current type id of this JSON object.
|
typeId
[get]
|
Json |
Returns the type id corresponding to the given D type .
|
undefined
[get]
|
Json |
New JSON value of Type
|
Methods
Name | Description |
---|---|
appendArrayElement
|
The append operator will append arrays. This method always appends it's argument as an array element , so nested arrays can be created.
|
clone
|
Clones a JSON value recursively. |
opApply
|
Allows foreach iterating over JSON objects and arrays. |
opAssign
|
Allows assignment of D values to a JSON value.
|
opBinary
|
Performs binary operations between JSON values. |
opBinaryRight
|
Performs binary operations between JSON values. |
opBinaryRight
|
Checks wheter a particular key is set and returns a pointer to it.
|
opCast
|
Converts the JSON value to the corresponding D type - types must match exactly.
|
opCmp
|
Compares two JSON values. |
opEquals
|
Compares two JSON values for equality. |
opIndex
|
Allows direct indexing of object typed JSON values using a string as
the key .
|
opIndex
|
Allows direct indexing of array typed JSON values. |
opOpAssign
|
Performs binary operations between JSON values. |
opSlice
|
|
opSlice
|
Returns a slice of a JSON array. |
opUnary
|
Performs unary operations on the JSON value. |
remove
|
Allows removal of values from Type Json objects.
|
toPrettyString
|
Returns the JSON object as a "pretty" string. |
toString
|
Returns the JSON object as a string. |
Enums
Name | Description |
---|---|
Type
|
Represents the run time type of a JSON value.
|
Aliases
Name | Description |
---|---|
opDollar
|
Authors
Sönke Ludwig
Copyright
© 2012-2015 RejectedSoftware e.K.
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.