Syntax
json.values(object: table): tableArguments
| Name | Type | Description |
|---|---|---|
object | table | Table to enumerate. The function checks this argument with type checking. |
Returns
| Name | Type | Description |
|---|---|---|
values | table | New array-style table containing the direct values from the input table. The output is marked as a JSON array. Enumeration uses table iteration, so no ordering guarantee is visible in the function. |
Description
Returns the direct values from a table in a new JSON array table. JSON metadata entries are not included.
Call it with 1 parameter(s): object. The argument table explains which values are required and which ones only refine the behavior.
It returns values (table). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Collect the direct values from a table into a JSON array-marked table.
local list = json.array({ "one", "two" })
for _, value in ipairs(json.values(list)) do
print(value)
end