PowerShell
PowerShell
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 PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$arr1 = New-Object Chilkat.JsonArray
$arr2 = New-Object Chilkat.JsonArray
$s = "[{`"a`":1}, {`"b`":2}, {`"c`":3}]"
$sEmpty = "[]"
$arr1.Load($s)
$arr2.Load($sEmpty)
$jObj = New-Object Chilkat.JsonObject
$arr1.ObjectAt2(1,$jObj)
$arr2.AddObjectCopyAt(-1,$jObj)
$($arr2.Emit())
# output is: [{"b":2}]