D JSON (WAT?!)

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 8 08:34:31 PDT 2014


On Fri, 08 Aug 2014 14:07:33 +0000, Pavel wrote:

> 
> I know that as per JSON spec there's no boolean type specified, only
> separate true and false values, which are specified as type in
> http://dlang.org/library/std/json/JSON_TYPE.html, so I guess the only
> way to check boolean in JSONValue it is to write:
> 
> if (json4.type == JSON_TYPE.True) {
> } else {
> }
> 
> Am I right?

That's right.  Perhaps we need an `asBool` function or even an
opCast!bool that returns false on FALSE, NULL, and possibly empty strings/
objects/arrays.


More information about the Digitalmars-d-learn mailing list