Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim arr1 As New ChilkatJsonArray
Dim arr2 As New ChilkatJsonArray

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

success = arr1.Load(s)
success = arr2.Load(sEmpty)

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

success = arr2.AddObjectCopyAt(-1,jObj)

Debug.Print arr2.Emit()

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