Sample code for 30+ languages & platforms
JavaScript

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

Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var json = new CkJsonObject();
json.EmitCompact = false;

json.AppendString("abc","123");

var st = new CkStringTable();
st.Append("a");
st.Append("b");
st.Append("c");
st.Append("d");

json.AppendStringArray("strArray",st);

console.log(json.Emit());

// Output:

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