Create an empty json object with std.json

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 22 20:45:33 PST 2016


On Fri, 22 Jan 2016 17:34:58 +0000, userABCabc123 wrote:
> It's true that it can be problematic, for example with an input
> contract, or for subtyping a JSONValue as something like struct
> JSONValueThatAlwayObject{}...
> 
> But there is only 3 ways in std.json, from a literal, using the
> deprecated way or the "lazy" way.

Which works out to one way that actually has the behavior that Andrea 
needs, and that involves parsing javascript. That's not ideal.

Vibe.d has a static method 'emptyObject' that returns a new empty object. 
That would be handy here.


More information about the Digitalmars-d-learn mailing list