CTFE Evaluation with JSON Objects

rbscott tjonsies818 at yahoo.com
Thu Jan 23 09:37:32 UTC 2020


On Thursday, 23 January 2020 at 00:20:24 UTC, Petar Kirov 
[ZombineDev] wrote:
> Hi,
>
> I hope this helps:
>
> ```D
> import std.json;
>
> void main()
> {
>     const jsonObject = parseJSON(`{ "my key" : "some value", 
> "integer": 42 }`);
>     pragma(msg, jsonObject["my key"].str);
>     pragma(msg, jsonObject["integer"].tupleof[0].uinteger);
> }
> ```
>
> Cheers,
> Petar

Hi Petar,

This worked perfectly. I was stuck on that for a while, and now I 
understand what is going on. Using tupleof is a nice trick!

Thanks!
rbscott


More information about the Digitalmars-d mailing list