std.json dynamic initialization of JSONValue

Adam D. Ruppe destructionator at gmail.com
Thu Dec 1 15:01:55 PST 2011


On Thu, Dec 01, 2011 at 03:45:35PM -0700, Kai Meyer wrote:
> I can't seem to figure out how to do this:

You might do it with a template that goes
through various types.

Check out web.d in here:
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/


and search for toJsonValue for an example of what
I mean.


Then you could do

it.object["whatever"] = toJsonValue("my string");


There's also toJson() in there to jump straight to
getting a json string of a particular D variable.



More information about the Digitalmars-d-learn mailing list