Skip to main content

Value

property Value: Boolean read write;

Example

procedure ScriptEvent(var Value: variant);
var
Flag: TJSONBoolean;
begin
Flag := TJSONBoolean.Create;
try
Flag.Value := True;
Flag.Clear;
Value := Flag.Value; // True is retained, although Flag.IsNull is True.
finally
Flag.Free;
end;
end;

Usage

Value reads or replaces the retained Boolean payload and makes the JSON node non-null on assignment.

Additional Technical Info

Value reads or writes the native Boolean stored by TJSONBoolean. A fresh node reads False. Assigning either True or False also sets inherited IsNull to False; False is an ordinary JSON Boolean value, not a null sentinel.

Reading this property returns the retained field directly and does not consult null state. Clear or IsNull := True therefore leaves the last Boolean visible through Value, even though inherited AsString is blank. Check IsNull before consuming the payload when null is meaningful.

When the node is non-null, a containing object or array serializes the value as the unquoted lowercase literal true or false. Setting Value performs no text parsing and cannot raise a conversion error.

The property does not change the node's Name, ownership or parent. A parent-owned node remains borrowed and must not be freed separately.

External references

Created 2026-07-20