JSON

json.values

Returns the values of a JSON object as an array table.

Syntax

json.values(object: table): table

Arguments

NameTypeDescription
objecttableObject, table, or drawing value to inspect or change.

Returns

NameTypeDescription
valuestableArray table containing object values.

Description

Returns the values of a JSON object as an array table.

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 an object's values into a JSON array.

local record = {
    first = "one",
    second = "two",
}

for _, value in ipairs(json.values(record)) do
    print(value)
end