Lua tables can contain other tables, forming nested structures. These become nested JSON objects.
config = {
["host"] = "localhost",
["port"] = 8080,
["options"] = {
["debug"] = true,
["timeout"] = 30,
},
}
{
"config": {
"host": "localhost",
"port": 8080,
"options": {
"debug": true,
"timeout": 30
}
}
}
Table keys can be bracketed strings like ["host"], bracketed integers like [1], or even bracketed booleans and floats. Regardless of the original key type in Lua, all keys become strings in JSON since that is all JSON supports. The nesting depth is unlimited (well, aside from your available memory).
This is common in SavedVariables files where addons store deeply nested configuration and state data.
Want more flexibility? Open the interactive converter to try any Lua input with all available options.