Unicode C++
Unicode C++
JSON Insert Empty Array or Object
See more JSON Examples
Demonstrates how to use the UpdateNewArray and UpdateNewObject methods to insert an empty array or object.Note: The UpdateNewArray an UpdateNewObject methods were introduced in Chilkat v9.5.0.75.
Chilkat Unicode C++ Downloads
#include <CkJsonObjectW.h>
void ChilkatSample(void)
{
bool success = false;
CkJsonObjectW json;
// The following code builds the following JSON, which contains both an empty array and empty object:
// {
// "abc": {
// "xyz": [
// {
// "Name": "myName",
// "Description": "description",
// "ScheduleDefinition": "schedule definition",
// "ExceptionScheduleDefinition": "",
// "Attribute": [
// ],
// "SomeEmptyObject": {},
// "token": "token"
// }
// ]
// }
// }
json.UpdateString(L"abc.xyz[0].Name",L"myName");
json.UpdateString(L"abc.xyz[0].Description",L"description");
json.UpdateString(L"abc.xyz[0].ScheduleDefinition",L"schedule definition");
json.UpdateString(L"abc.xyz[0].ExceptionScheduleDefinition",L"");
json.UpdateNewArray(L"abc.xyz[0].Attribute");
json.UpdateNewObject(L"abc.xyz[0].SomeEmptyObject");
json.UpdateString(L"abc.xyz[0].token",L"token");
json.put_EmitCompact(false);
wprintf(L"%s\n",json.emit());
}