AutoIt
AutoIt
Copy JSON Object from one JSON Array to Another
See more JSON Examples
Demonstrates how to copy an object in a JSON array to another JSON array.Chilkat AutoIt Downloads
$oArr1 = ObjCreate("Chilkat.JsonArray")
$oArr2 = ObjCreate("Chilkat.JsonArray")
Local $s = "[{""a"":1}, {""b"":2}, {""c"":3}]"
Local $sEmpty = "[]"
$oArr1.Load($s)
$oArr2.Load($sEmpty)
$oJObj = ObjCreate("Chilkat.JsonObject")
$oArr1.ObjectAt2(1,$oJObj)
$oArr2.AddObjectCopyAt(-1,$oJObj)
ConsoleWrite($oArr2.Emit() & @CRLF)
; output is: [{"b":2}]