Unicode C++
Unicode C++
Copy JSON Object from one JSON Array to Another
See more JSON Examples
Demonstrates how to copy an object in a JSON array to another JSON array.Chilkat Unicode C++ Downloads
#include <CkJsonArrayW.h>
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
CkJsonArrayW arr1;
CkJsonArrayW arr2;
const wchar_t *s = L"[{\"a\":1}, {\"b\":2}, {\"c\":3}]";
const wchar_t *sEmpty = L"[]";
arr1.Load(s);
arr2.Load(sEmpty);
CkJsonObjectW jObj;
arr1.ObjectAt2(1,jObj);
arr2.AddObjectCopyAt(-1,jObj);
wprintf(L"%s\n",arr2.emit());
// output is: [{"b":2}]
}