Sample code for 30+ languages & platforms
Node.js

JSON AppendArray2 Example

Demonstrates the AppendArray2 function.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var json = new chilkat.JsonObject();
    json.Load("{ \"name\": \"John\", \"marbles\": 100 }");

    //  Append an empty array named "xyz"
    var jarr = new chilkat.JsonArray();
    json.AppendArray2("xyz",jarr);

    console.log(json.Emit());
    //  Expected output is:   {"name":"John","marbles":100,"xyz":[]}

    //  Add elements to the array.
    jarr.AddStringAt(-1,"hello");
    jarr.AddIntAt(-1,256);

    console.log(json.Emit());
    //  Expected output is:  {"name":"John","marbles":100,"xyz":["hello",256]}

}

chilkatExample();