Sample code for 30+ languages & platforms
C#

Example: JsonObject.NewArrayOf method

See more JSON Examples

Demonstrates the NewArrayOf method.

Chilkat C# Downloads

C#
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"
//    ]
//  }