As an addition to the question, I'd like to understand how Json.undefined
is used.
Take a look at this example:
auto j = Json.emptyObject;
logInfo(to!string(j.test.type == Json.Type.undefined));
logInfo(to!string(j.test.type == Json.Type.Undefined));
logInfo(to!string(j.test is Json.undefined));
logInfo(to!string(j.test == Json.undefined));
j.test = Json.undefined;
logInfo(to!string(j.test is Json.undefined));
logInfo(to!string(j.test == Json.undefined));
The output is:
true
true
false
false
true
false
It seems odd that a non-existing field test
in j
is not undefined
, and is not equal to undefined
, though its type is equal to Json.Type.undefined
.
Also can anyone explain why j.test is Json.undefined
produces false
, after explicit assignment: j.test = Json.undefined;
?