Sample code for 30+ languages & platforms
Lua Requires Chilkat v9.5.0.67+

JSON Append String Array

See more JSON Examples

Demonstrates how to append an array of strings from a string table object.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local json = chilkat.JsonObject.new()
json.emit_compact = false

json:append_string("abc", "123")

local st = chilkat.StringTable.new()
st:append("a")
st:append("b")
st:append("c")
st:append("d")

json:append_string_array("strArray", st)

print(json:emit())

-- Output:

--     {
--       "abc": "123",
--       "strArray": [
--         "a",
--         "b",
--         "c",
--         "d"
--       ]
--     }