Syntax
json.isArray(value: any): booleanArguments
| Name | Type | Description |
|---|---|---|
value | any | Value to inspect. Non-table values return false. |
Returns
| Name | Type | Description |
|---|---|---|
isArray | boolean | true when the value is a table marked as a JSON array or an unmarked table with contiguous positive integer keys from 1 with its maximum index. Empty unmarked tables return false. |
Description
Returns whether a value is treated as a JSON array by Real's JSON table detection.
Call it with 1 parameter(s): value. The argument table explains which values are required and which ones only refine the behavior.
It returns isArray (boolean). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Check whether a table is treated as a JSON array by Real's JSON encoder.
local items = json.array({ "one", "two" })
local record = json.object({ name = "Real" })
local inferred = { "one", "two" }
print(json.isArray(items))
print(json.isArray(record))
print(json.isArray(inferred))