Swift
Swift
JSON Append String Array
See more JSON Examples
Demonstrates how to append an array of strings from a string table object.Note: This example uses the AppendStringTable method, which was introduced in Chilkat v9.5.0.67
Chilkat Swift Downloads
func chilkatTest() {
let json = CkoJsonObject()!
json.emitCompact = false
json.appendString(name: "abc", value: "123")
let st = CkoStringTable()!
st.append(value: "a")
st.append(value: "b")
st.append(value: "c")
st.append(value: "d")
json.appendStringArray(name: "strArray", values: st)
print("\(json.emit()!)")
// Output:
// {
// "abc": "123",
// "strArray": [
// "a",
// "b",
// "c",
// "d"
// ]
// }
}