Go
Go
JSON AppendObject2 Example
Demonstrates the AppendObject2 function.Chilkat Go Downloads
json := chilkat.NewJsonObject()
json.Load("{ \"name\": \"John\", \"marbles\": 100 }")
// Append an empty object named "addr"
jObj := chilkat.NewJsonObject()
json.AppendObject2("addr",jObj)
fmt.Println(*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)
fmt.Println(*json.Emit())
// Expected output is: {"name":"John","marbles":100,"addr":{"street":"1200 Elm St.","city":"Springfield","zip":60606}}
json.DisposeJsonObject()
jObj.DisposeJsonObject()