Syntax
json.keys(object: table): tableArguments
| Name | Type | Description |
|---|---|---|
object | table | Table to inspect. The function requires this argument to be a table. |
Returns
| Name | Type | Description |
|---|---|---|
keys | table | New array table containing the source table keys, excluding Real's JSON type marker. The order follows table iteration iteration and is not sorted by this function. |
Description
Returns the visible keys of a table in a new table marked as a JSON array.
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 the visible keys of a table into a new JSON array table.
local record = {
name = "Real",
enabled = true,
[5] = "numeric key",
}
for _, key in ipairs(json.keys(record)) do
print(key)
end