Sample code for 30+ languages & platforms
C#

JSON AppendObject2 Example

Demonstrates the AppendObject2 function.

Chilkat C# Downloads

C#
Chilkat.JsonObject json = new Chilkat.JsonObject();
json.Load("{ \"name\": \"John\", \"marbles\": 100 }");

//  Append an empty object named "addr"
Chilkat.JsonObject jObj = new Chilkat.JsonObject();
json.AppendObject2("addr",jObj);

Debug.WriteLine(json.Emit());
//  Expected output is:   {"name":"John","marbles":100,"addr":{}}

//  Add members to the object.
jObj.AppendString("street","1200 Elm St.");
jObj.AppendString("city","Springfield");
jObj.AppendInt("zip",60606);

Debug.WriteLine(json.Emit());
//  Expected output is:  {"name":"John","marbles":100,"addr":{"street":"1200 Elm St.","city":"Springfield","zip":60606}}