Closed kattunga closed 9 years ago
jdtNone tells you that the item doesn't exist. So "Variant-Null" has to become "fdtObject:nil" if it is stored. The bug is that the Variant implementation handles varEmpty and varNull the wrong way.
I'll fix the variant implementation so that it returns "Unassigned" if the item doesn't exist (Typ=jdtNone) and "Null" if it is jdtObject:nil. Setting "Null" changes the value to "jdtObject:nil" and setting "Unassigned" raises an EJsonCastException.
doc['Key'] := Null;
Check(doc['Key'].Typ = jdtObject);
Check(doc['Key'].ObjectValue = nil);
V := doc['NotSet'];
Check(O['NotSet'].Typ = jdtNone);
Check(VarIsEmpty(V));
Sorry, I was not correctly understanding the meaning of jdtNone.
You found a bug anyhow.
Hi, when you parse a Json string, null values are stored as jdtObject instead of jdtNone.
Can be reproduced with following code:
This doesn't happen when values are assigned one by one: