Sample code for 30+ languages & platforms
Xojo Plugin

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 Xojo Plugin Downloads

Xojo Plugin
Dim arr1 As New Chilkat.JsonArray
Dim arr2 As New Chilkat.JsonArray

Dim s As String
s = "[{""a"":1}, {""b"":2}, {""c"":3}]"
Dim sEmpty As String
sEmpty = "[]"

Dim success As Boolean
success = arr1.Load(s)
success = arr2.Load(sEmpty)

Dim jObj As New Chilkat.JsonObject
success = arr1.ObjectAt2(1,jObj)

success = arr2.AddObjectCopyAt(-1,jObj)

System.DebugLog(arr2.Emit())

// output is:   [{"b":2}]