jsArray
jsArray = 3
Example
function ArrayItemCount(Value: TJSONValue): Integer;
begin
if Value.ValueType = jsArray then
Result := Value.AsArray.Count
else
Result := 0;
end;
Usage
jsArray identifies a Velox TJSONArray containing an owned, ordered sequence of JSON child values.
Additional Technical Info
jsArray is ordinal 3 of TJSONValueType. The base constructor assigns it when the concrete object is TJSONArray. Check it before using TJSONValue.AsArray, which performs a checked Delphi class cast and raises for another kind.
A TJSONArray stores children in an owning TObjectList: order and duplicates are preserved, and deleting, clearing or destroying the array frees the removed/contained child objects. Do not retain a child reference after its owner removes or destroys it. Clone/CopyFrom clone children rather than sharing them.
Arrays derive from TJSONText and always report IsNull = False, including an empty array. Setting their inherited null flag does not change that getter or their ValueType; use an actual jsNull child to represent JSON null. Empty and null are therefore distinct: empty AsString is [].
Compact AsString serializes children in order. String children are escaped/quoted, null children become null, and nested arrays/objects use their own serialization. This means array output inherits the numeric locale, string escaping and object serialization limitations documented on jsNumber, jsString and jsObject. Do not treat output as standards-safe until those constraints are acceptable or independently validated.
The example is source-reviewed only; no JSON parsing, serialization, ownership, runtime or image test ran.
Related Code Library entries
jsObject- named JSON container.jsNull- concrete null child.TJSONArray- array class reference.
External references
Created 2026-07-15