vibe.d beta banner
get vibe.d
0.7.31

Struct Json

Represents a single JSON value.

struct Json;

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.

Constructors

Constructors

NameDescription
thisConstructor for a JSON object.

Properties

Properties

NameTypeDescription
byIndexValue[get]std.range.Zip!(std.range.iota!(int,ulong).iota(int,ulong).Result,vibe.data.json.Json[])Iterates over all index/value pairs of an array.
byKeyValue[set]object.byKeyValue!(vibe.data.json.Json[string],string,vibe.data.json.Json)Iterates over all key/value pairs of an object.
emptyArray[get]JsonNew JSON value of Type.Array
emptyObject[get]JsonNew JSON value of Type.Object
get[get]inout(T)Converts the JSON value to the corresponding D type - types must match exactly.
length[get]ulongReturns the number of entries of string, array or object typed JSON values.
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.TypeThe current type id of this JSON object.
typeId[get]Json.TypeReturns the type id corresponding to the given D type.
undefined[get]JsonNew JSON value of Type.Undefined

Methods

Methods

NameDescription
appendArrayElementThe append operator will append arrays. This method always appends it's argument as an array element, so nested arrays can be created.
byValueIterates over all values of an object or array.
cloneClones a JSON value recursively.
opApplyAllows foreach iterating over JSON objects and arrays.
opAssignAllows assignment of D values to a JSON value.
opBinaryPerforms binary operations between JSON values.
opBinaryRightPerforms binary operations between JSON values.
opBinaryRightChecks wheter a particular key is set and returns a pointer to it.
opCastConverts the JSON value to the corresponding D type - types must match exactly.
opCmpCompares two JSON values.
opEqualsCompares two JSON values for equality.
opIndexAllows direct indexing of array typed JSON values.
opIndexAllows direct indexing of object typed JSON values using a string as the key.
opOpAssignPerforms binary operations between JSON values.
opSliceReturns a slice of a JSON array.
opSlice
opUnaryPerforms unary operations on the JSON value.
removeAllows removal of values from Type.Object Json objects.
toPrettyStringReturns the JSON object as a "pretty" string.
toStringReturns the JSON object as a string.

Enums

Enums

NameDescription
TypeRepresents the run time type of a JSON value.

Aliases

Aliases

NameDescription
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.