Syntax
json.keys(object: table): tableArguments
| Name | Type | Description |
|---|---|---|
object | table | Object, table, or drawing value to inspect or change. |
Returns
| Name | Type | Description |
|---|---|---|
keys | table | Array table containing object keys. |
Description
Returns the keys 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 keys (table). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Collect an object's keys into a JSON array.
local record = {
name = "Real",
enabled = true,
}
for _, key in ipairs(json.keys(record)) do
print(key)
end