Table of Contents

TJElement Class

Abstract base class for all JSON elements in the JSON Document Object Model.

Remarks

TJElement serves as the root of the JSON DOM class hierarchy. It provides type checking methods (IsArray, IsObject, etc.), type casting methods (AsArray, AsObject, etc.), and value access methods (AsBoolean, AsString, etc.) for working with JSON elements in a type-safe manner. Concrete subclasses include TJArray, TJObject, TJPrimitive, and TJNull.

Syntax

Unit: Bcl.Json.Classes

TJElement = class(TObject);

Methods

Name Description
IsArray Returns True if this element is a TJArray.
IsObject Returns True if this element is a TJObject.
IsPrimitive Returns True if this element is a TJPrimitive.
IsNull Returns True if this element is a TJNull.
AsArray Casts this element to TJArray.
AsObject Casts this element to TJObject.
AsPrimitive Casts this element to TJPrimitive.
AsNull Casts this element to TJNull.
AsBoolean Returns the value of this element as a Boolean.
AsString Returns the value of this element as a string.
AsDouble Returns the value of this element as a Double.
AsInteger Returns the value of this element as an Integer.
AsInt64 Returns the value of this element as an Int64.
IsBoolean Returns True if this element holds a Boolean value.
IsString Returns True if this element holds a string value.
IsDouble Returns True if this element holds a Double value.
IsInteger Returns True if this element holds an Integer value.
IsInt64 Returns True if this element holds an Int64 value.
Clone Creates a deep copy of this JSON element.
ToJSONValue Converts this JSON element to a System.Json.TJSONValue instance.
FromJSONValue Creates a TJElement from a System.Json.TJSONValue instance.