Json.opIndex - multiple declarations
- Function Json.opIndex
- Function Json.opIndex
Function Json.opIndex
Allows direct indexing of object typed JSON values using a string as
the key
.
Prototypes
Example
Json value = Json .emptyObject;
value["a"] = 1;
value["b"] = true;
value["c"] = "foo";
assert(value["a"] == 1);
assert(value["b"] == true);
assert(value["c"] == "foo");
}
/**
Returns a slice of a JSON array.
*/
inout(Json[]) opSlice() inout { checkType!(Json[])(); return m_array;
Function Json.opIndex
Allows direct indexing of array typed JSON values.
Prototype
ref inout inout(Json) opIndex(
ulong idx
);
Example
Json value = Json .emptyArray;
value ~= 1;
value ~= true;
value ~= "foo";
assert(value[0] == 1);
assert(value[1] == true);
assert(value[2] == "foo");
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.