JSONValue.opIndexAssign

Operator sets value for element of JSON object by key.

If JSON value is null, then operator initializes it with object and then sets value for it.

  1. void opIndexAssign(T value, string key)
    struct JSONValue
    void
    opIndexAssign
    (
    T
    )
    (
    auto ref T value
    ,
    string key
    )
  2. void opIndexAssign(T arg, size_t i)

Throws

JSONException if type is not JSONType.object or JSONType.null_.

Examples

JSONValue j = JSONValue( ["language": "D"] );
j["language"].str = "Perl";
assert( j["language"].str == "Perl" );

Meta