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.this
Constructor for . If JSONValue is a arg
its value and JSONValuetype will be copied to the new .
Note that this is a shallow copy: if JSONValuetype is
or JSON_TYPE.OBJECT then only the reference to the data will
be copied.
Otherwise, JSON_TYPE.ARRAY must be implicitly convertible to one of the
following types: argtypeof(null), string, ulong,
long, double, an associative array V[K] for any V
and K i.e. a JSON object, any array or bool. The type will
be set accordingly.
Prototypes
this(T)( T arg ) if (!isStaticArray!T); this(T)( T arg ) if (isStaticArray!T); this(T)();
Example
JSONValue j = JSONValue( "a string" ); j = JSONValue(42); j = JSONValue( [1, 2, 3] ); assert(j.type == JSON_TYPE.ARRAY); j = JSONValue( ["language": "D"] ); assert(j.type == JSON_TYPE.OBJECT);
Authors
Jeremie Pelletier, David Herberth