Sample code for 30+ languages & platforms
AutoIt

JSON AppendObject2 Example

Demonstrates the AppendObject2 function.

Chilkat AutoIt Downloads

AutoIt
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.Load("{ ""name"": ""John"", ""marbles"": 100 }")

; Append an empty object named "addr"
$oJObj = ObjCreate("Chilkat.JsonObject")
$oJson.AppendObject2("addr",$oJObj)

ConsoleWrite($oJson.Emit() & @CRLF)
; Expected output is:   {"name":"John","marbles":100,"addr":{}}

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

ConsoleWrite($oJson.Emit() & @CRLF)
; Expected output is:  {"name":"John","marbles":100,"addr":{"street":"1200 Elm St.","city":"Springfield","zip":60606}}