View source code
Display the source code in std/json.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.json.JSONValue.opIndexAssign
Operator sets
for element of JSON value
object
by key
If JSON value
is null, then operator initializes it with object
and then
sets
for it.
value
Throws
if JSONException
is not type
JSON_TYPE.OBJECT
or
.
JSON_TYPE.NULL
Prototype
void opIndexAssign(T)( T value, string key ) pure;
Example
JSONValue j = JSONValue( ["language": "D"] ); j["language"].str = "Perl"; assert( j["language"].str == "Perl" );
Example
JSONValue j = JSONValue( ["Perl", "C"] ); j[1].str = "D"; assert( j[1].str == "D" );
Example
JSONValue j = [ "language": "D", "author": "walter" ]; string a = ("author" in j).str;
Authors
Jeremie Pelletier, David Herberth