Unicode C++
Unicode C++
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat Unicode C++ Downloads
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
const wchar_t *big_cats = L"[\"lion\",\"tiger\",\"leopard\",\"jaguar\",\"cheetah\",\"snow leopard\",\"clouded leopard\",\"cougar\",\"puma\",\"panther\"]";
CkJsonObjectW json;
json.UpdateString(L"test",L"abc");
success = json.NewArrayOf(L"big_cats",big_cats);
if (success == false) {
wprintf(L"%s\n",json.lastErrorText());
return;
}
json.put_EmitCompact(false);
wprintf(L"%s\n",json.emit());
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }
}