json.array

Creates a table marked for JSON array encoding.

Syntax

Signature
json.array(Table: table?) -> table

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
Tabletable?Table whose array entries should be copied.

Returns

TypeDescription
tableNew table marked as a JSON array.

Notes

When Table is supplied, copies its sequential entries from 1 through its length. The input table is left unchanged and non-array fields are not copied. With no argument, returns an empty marked array.

Example

Luau
local Empty = json.array()
print(json.encode(Empty))
local Copy = json.array({1, 2, 3})
print(json.encode(Copy))