AutoIt
AutoIt
JSON AppendArray2 Example
Demonstrates the AppendArray2 function.Chilkat AutoIt Downloads
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.Load("{ ""name"": ""John"", ""marbles"": 100 }")
; Append an empty array named "xyz"
$oJarr = ObjCreate("Chilkat.JsonArray")
$oJson.AppendArray2("xyz",$oJarr)
ConsoleWrite($oJson.Emit() & @CRLF)
; Expected output is: {"name":"John","marbles":100,"xyz":[]}
; Add elements to the array.
$oJarr.AddStringAt(-1,"hello")
$oJarr.AddIntAt(-1,256)
ConsoleWrite($oJson.Emit() & @CRLF)
; Expected output is: {"name":"John","marbles":100,"xyz":["hello",256]}