json. keys Synchronous
Collect the keys of a table into an array. This helps when presenting a list of available settings or inspecting an object with fields chosen at runtime.
Luau
json.keys(value: Table) -> {any}Parameters
| Parameter | Type | Description |
|---|---|---|
value | Table | Table whose keys should be collected. |
Returns
{any}An array containing the keys in table iteration order.
Usage notes
Iteration order is not a stable display order. Sort the result when people need a predictable list.
Example
Luau
local keys = json.keys({ theme = "dark", volume = 0.5 })
table.sort(keys)
for _, key in ipairs(keys) do print(key) end