Skip to main content

Arguments

table
Optional source table. When omitted or nil, json.array returns a new empty array-marked table. When provided, only numeric sequence entries from 1 with #source are copied into the new table.

Returns

table
New table with the JSON array marker. json.encode serializes it as a JSON array; the original source table is not returned.

Example

Create an array-marked copy so json.encode serializes the value as a JSON array.