- appendArrayElement
void appendArrayElement(Json element)
The append operator will append arrays. This method always appends it's argument as an array element, so nested arrays can be created.
- clone
Json clone()
Clones a JSON value recursively.
- opApply
int opApply(int delegate(ref Json obj) del)
int opApply(int delegate(ref const Json obj) del)
int opApply(int delegate(ref size_t idx, ref Json obj) del)
int opApply(int delegate(ref size_t idx, ref const Json obj) del)
int opApply(int delegate(ref string idx, ref Json obj) del)
int opApply(int delegate(ref string idx, ref const Json obj) del)
Allows foreach iterating over JSON objects and arrays.
- opAssign
Json opAssign(Json v)
void opAssign(typeof(null) )
bool opAssign(bool v)
int opAssign(int v)
long opAssign(long v)
BigInt opAssign(BigInt v)
double opAssign(double v)
string opAssign(string v)
Json[] opAssign(Json[] v)
Json[string] opAssign(Json[string] v)
Allows assignment of D values to a JSON value.
- opBinary
Json opBinary(const(Json) other)
Json opBinary(Json other)
Json opBinary(bool other)
Json opBinary(long other)
Json opBinary(BigInt other)
Json opBinary(double other)
Json opBinary(string other)
Json opBinary(Json[] other)
- opBinaryRight
Json opBinaryRight(bool other)
Json opBinaryRight(long other)
Json opBinaryRight(BigInt other)
Json opBinaryRight(double other)
Json opBinaryRight(string other)
Json opBinaryRight(Json[] other)
Performs binary operations between JSON values.
- opBinaryRight
inout(Json)* opBinaryRight(string other)
Checks wheter a particular key is set and returns a pointer to it.
- opCast
T opCast()
Converts this Json object to a std.json.JSONValue object
- opCast
inout(T) opCast()
Converts the JSON value to the corresponding D type - types must match exactly.
- opCmp
int opCmp(Json other)
Compares two JSON values.
- opEquals
bool opEquals(Json other)
bool opEquals(typeof(null) )
bool opEquals(bool v)
bool opEquals(int v)
bool opEquals(long v)
bool opEquals(BigInt v)
bool opEquals(double v)
bool opEquals(string v)
Compares two JSON values for equality.
- opIndex
inout(Json) opIndex(size_t idx)
Allows direct indexing of array typed JSON values.
- opIndex
const(Json) opIndex(string key)
Json opIndex(string key)
Allows direct indexing of object typed JSON values using a string as
the key.
- opOpAssign
void opOpAssign(Json other)
void opOpAssign(T other)
Performs binary operations between JSON values.
- opSlice
inout(Json[]) opSlice()
Returns a slice of a JSON array.
- opSlice
inout(Json[]) opSlice(size_t from, size_t to)
- opUnary
Json opUnary()
Performs unary operations on the JSON value.
- remove
void remove(string item)
Allows removal of values from Type.Object Json objects.
- toPrettyString
string toPrettyString(int level)
Returns the JSON object as a "pretty" string.
- toString
void toString(void delegate(const(char)[]) @(safe) sink, FormatSpec!char fmt)
Returns the JSON object as a string.
- toString
string toString()
void toString(void delegate(const(char)[]) @(system) sink, FormatSpec!char fmt)
Returns the JSON object as a string.
- byIndexValue
auto byIndexValue [@property getter]
Iterates over all index/value pairs of an array.
- byKeyValue
auto byKeyValue [@property getter]
Iterates over all key/value pairs of an object.
- byValue
auto byValue [@property getter]
Iterates over all values of an object or array.
- emptyArray
Json emptyArray [@property getter]
New JSON value of Type.Array
- emptyObject
Json emptyObject [@property getter]
New JSON value of Type.Object
- get
inout(T) get [@property getter]
Converts the JSON value to the corresponding D type - types must match exactly.
- length
size_t length [@property getter]
Returns the number of entries of string, array or object typed JSON values.
- opt
const(T) opt [@property setter]
T opt [@property setter]
Returns the native type for this JSON if it matches the current runtime type.
- to
inout(T) to [@property getter]
Converts the JSON value to the corresponding D type - types are converted as necessary.
- type
Type type [@property getter]
The current type id of this JSON object.
- typeId
Type typeId [@property getter]
Returns the type id corresponding to the given D type.
- undefined
Json undefined [@property getter]
New JSON value of Type.Undefined
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 a JSONException. Additionally, an explicit cast or using get!() or to!() is required to convert a JSON value to the corresponding static D type.