Sample code for 30+ languages & platforms
Unicode C++

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 Unicode C++ Downloads

Unicode C++
#include <CkJsonObjectW.h>
#include <CkStringTableW.h>

void ChilkatSample(void)
    {
    CkJsonObjectW json;
    json.put_EmitCompact(false);

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

    CkStringTableW st;
    st.Append(L"a");
    st.Append(L"b");
    st.Append(L"c");
    st.Append(L"d");

    json.AppendStringArray(L"strArray",st);

    wprintf(L"%s\n",json.emit());

    //  Output:

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