Table of Contents

TJObject Class

Represents a JSON object containing an unordered collection of name/value pairs.

Remarks

TJObject stores members as TJMember instances. Members can be accessed by name using the default Members property. Adding a member with an existing name replaces the previous value. The object owns all its members and frees them upon destruction. Supports enumeration via for..in loops, iterating over TJMember instances.

Syntax

Unit: Bcl.Json.Classes

TJObject = class(TJElement);

Constructors

Name Description
Create Creates a new empty JSON object.

Methods

Name Description
Clone Creates a deep copy of this JSON object, including all contained members.
Add Overloaded
Add(string, string)
Add(string, Integer)
Add(string, Int64)
Add(string, Double)
Add(string, Boolean)
Add(string, TJElement)
Remove Removes the member with the specified name from the object.
Get Gets the value of the member with the specified name.
Contains Checks whether a member with the specified name exists in this object.
GetEnumerator Returns an enumerator for iterating over the members of this object.
hasOwnProperty Checks whether this object has a member with the specified name. Provided for JavaScript compatibility.
keys Returns an array of all member names in the specified JSON object. Provided for JavaScript compatibility.

Properties

Name Description
Members[const Name] Gets or sets a member value by name. Reading returns nil if not found; writing adds or replaces the member.