Visual FoxPro
Visual FoxPro
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 FoxPro Downloads
LOCAL loArr1
LOCAL loArr2
LOCAL s
LOCAL lcSEmpty
LOCAL loJObj
loArr1 = CreateObject('Chilkat.JsonArray')
loArr2 = CreateObject('Chilkat.JsonArray')
s = '[{"a":1}, {"b":2}, {"c":3}]'
lcSEmpty = "[]"
loArr1.Load(s)
loArr2.Load(lcSEmpty)
loJObj = CreateObject('Chilkat.JsonObject')
loArr1.ObjectAt2(1,loJObj)
loArr2.AddObjectCopyAt(-1,loJObj)
? loArr2.Emit()
* output is: [{"b":2}]
RELEASE loArr1
RELEASE loArr2
RELEASE loJObj