Am 24.07.2014 17:54, schrieb Pavel:

Guess what, here's a new snippet:

import std.stdio;
import std.json;

void main() {
   scope(failure) writeln("FaILED!!");
   string jsonStr = `{ "name": "1", "type": "r" }`;
   auto parsed = parseJSON(jsonStr).object;
   writeln("fail" in parsed);
}

Output is:
null

WAT?!

Ofcourse, writing like:

writeln(cast(bool)("fail" in parsed));

Produces "false"... but why on earth boolean expression would output null?

PS: Sorry, for such an emotional boom, I'm so frustrated right now.

Relax :-)

And see http://dlang.org/hash-map.html

"in" doesn't just return if something is in a map.
If it is, it returns a pointer to the value, otherwise null.
Thus null.

Cheers,
Daniel

Reply via email to