Sample code for 30+ languages & platforms
Xbase++

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 Xbase++ Downloads

Xbase++
LOCAL oJson
LOCAL oSt

oJson := CreateObject("Chilkat.JsonObject")
oJson:EmitCompact := 0

oJson:AppendString("abc", "123")

oSt := CreateObject("Chilkat.StringTable")
oSt:Append("a")
oSt:Append("b")
oSt:Append("c")
oSt:Append("d")

oJson:AppendStringArray("strArray", oSt)

? oJson:Emit()

//  Output:

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

oJson:destroy()
oSt:destroy()