(Unicode C) JSON Append String Array
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
#include <C_CkJsonObjectW.h>
#include <C_CkStringTableW.h>
void ChilkatSample(void)
{
HCkJsonObjectW json;
HCkStringTableW st;
json = CkJsonObjectW_Create();
CkJsonObjectW_putEmitCompact(json,FALSE);
CkJsonObjectW_AppendString(json,L"abc",L"123");
st = CkStringTableW_Create();
CkStringTableW_Append(st,L"a");
CkStringTableW_Append(st,L"b");
CkStringTableW_Append(st,L"c");
CkStringTableW_Append(st,L"d");
CkJsonObjectW_AppendStringArray(json,L"strArray",st);
wprintf(L"%s\n",CkJsonObjectW_emit(json));
// Output:
// {
// "abc": "123",
// "strArray": [
// "a",
// "b",
// "c",
// "d"
// ]
// }
CkJsonObjectW_Dispose(json);
CkStringTableW_Dispose(st);
}
|