C#
C#
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat C# Downloads
bool success = false;
string big_cats = "[\"lion\",\"tiger\",\"leopard\",\"jaguar\",\"cheetah\",\"snow leopard\",\"clouded leopard\",\"cougar\",\"puma\",\"panther\"]";
Chilkat.JsonObject json = new Chilkat.JsonObject();
json.UpdateString("test","abc");
success = json.NewArrayOf("big_cats",big_cats);
if (success == false) {
Debug.WriteLine(json.LastErrorText);
return;
}
json.EmitCompact = false;
Debug.WriteLine(json.Emit());
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }