B4X Requires Chilkat v11.0.0+
B4X
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 B4X Downloads
Dim arr1 As ChilkatJsonArray
arr1.Initialize
Dim arr2 As ChilkatJsonArray
arr2.Initialize
Dim s As String = "[{" & Chr(34) & "a" & Chr(34) & ":1}, {" & Chr(34) & "b" & Chr(34) & ":2}, {" & Chr(34) & "c" & Chr(34) & ":3}]"
Dim sEmpty As String = "[]"
arr1.Load(s)
arr2.Load(sEmpty)
Dim jObj As ChilkatJsonObject
jObj.Initialize
arr1.ObjectAt2(1, jObj)
arr2.AddObjectCopyAt(-1, jObj)
Log(arr2.Emit)
' output is: [{"b":2}]