Skip to main content

JsonArray

function JsonArray: TJSONArray;

Example

procedure ScriptEvent(var Value: variant);
begin
JsonArray.Erase;
JsonArray.AddString('Example');
Value := JsonArray.Count;
end;

Usage

JsonArray provides the first reusable JSON array workspace for the current action. Use its add, load, combine and delete operations to build or inspect an array. Changes and item indexes remain visible to later scripts in the same action.

It is separate from JsonArray2 and the JSON object workspaces. Clear or reload it before using it for unrelated data. Reading JsonArray does not bind map records or serialise output automatically.

Additional Technical Info

JsonArray is a no-argument Velox scripting helper that returns a live object. It does not copy the object or make the returned reference private to the calling statement.

PropertyDetail
Return typeTJSONArray
OwnershipAction-owned and shared across the action's scripts
Creation/accessGetter call; see lifecycle below
Thread safetyMutable and not safe for concurrent/asynchronous use

Failures, safety and implementation cautions

Erase or load known state before appending, validate item types before casts, and remember that deletion changes later indexes. Do not free the array or retain item pointers after the action. Bound untrusted item counts, nesting and string sizes.

Class methods can raise on invalid state, parsing/conversion failures, I/O errors or invalid arguments unless their own contract documents a different result. Copy required scalar results before another script or operation can replace mutable state.

Related entry

  • TJSONArray documents the returned class and its exposed methods/properties.
  • Helpers compares lifetime, sharing and context rules for all helper objects.

External references

  • RFC 8259: JSON defines array syntax and interoperability constraints.
Created 2026-07-15