D JSON (WAT?!)

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 24 08:34:21 PDT 2014


On 07/24/2014 08:29 AM, Pavel wrote:

> writeln(parsed["fail"] == null);
>
> Now compiler complains:
>
> Error: incompatible types for ((parsed.opIndex("fail")) == (null)):
> 'JSONValue' and 'typeof(null)'
>
>
> WAT?!

Comparing against null should be done with the 'is' operator, not the == 
operator:

     if (x is null)

Ali



More information about the Digitalmars-d-learn mailing list