Create an empty json object with std.json
userABCabc123 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 22 08:45:22 PST 2016
On Friday, 22 January 2016 at 12:54:38 UTC, Andrea Fontana wrote:
> On Friday, 22 January 2016 at 12:05:48 UTC, userABCabc123 wrote:
>> when you add the first key, the value will be set to
>> JSON_TYPE.OBJECT
>>
>> ----
>> import std.json;
>>
>> void main(string[] args)
>> {
>> JSONValue json;
>> json["first"] = 0;
>> assert(json.type == JSON_TYPE.OBJECT);
>> }
>> ----
>
> That's right, but I need an empty object, without any key set!
But soon or later you'll need to add values to your object so
just imagine it's already an object, even if it will only become
one when you'll start to add some values.
I don't really get your problem here, as in the first message you
also start with an empty json.
More information about the Digitalmars-d-learn
mailing list