vibe.d beta banner
get vibe.d

Asynchronous I/O that doesn’t get in your way, written in D

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.


thisConstructor for a JSON object.


emptyArray[get]JsonNew JSON value of Type.Array
emptyObject[get]JsonNew JSON value of Type.Object
length[get]uintReturns the number of entries of string, array or object typed JSON values.
type[get]Json.TypeThe current type id of this JSON object.
undefined[get]JsonNew JSON value of Type.Undefined


appendArrayElementThe append operator will append arrays. This method always appends it's argument as an array element, so nested arrays can be created.
opApplyAllows foreach iterating over JSON objects and arrays.
opAssignAllows assignment of D values to a JSON value.
opCmpCompares two JSON values.
opEqualsCompares two JSON values for equality.
opIndexAllows direct indexing of object typed JSON values using a string as the key.
opIndexAllows direct indexing of array typed JSON values.
opSliceReturns a slice of a JSON array.
removeAllows removal of values from Type.Object Json objects.
toPrettyStringReturns the JSON object as a "pretty" string.
toStringReturns the JSON object as a string.


TypeRepresents the run time type of a JSON value.




getConverts the JSON value to the corresponding D type - types must match exactly.
opBinaryPerforms binary operations between JSON values.
opBinaryRightPerforms binary operations between JSON values.
opCastConverts the JSON value to the corresponding D type - types must match exactly.
opDispatchAllows to access existing fields of a JSON object using dot syntax.
opOpAssignPerforms binary operations between JSON values.
optReturns the native type for this JSON if it matches the current runtime type.
opUnaryPerforms unary operations on the JSON value.
toConverts the JSON value to the corresponding D type - types are converted as necessary.
typeIdReturns the type id corresponding to the given D type.

Sönke Ludwig


© 2012-2013 RejectedSoftware e.K.


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.