Sample code for 30+ languages & platforms
Visual FoxPro

JSON AppendArray2 Example

Demonstrates the AppendArray2 function.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL loJson
LOCAL loJarr

loJson = CreateObject('Chilkat.JsonObject')
loJson.Load('{ "name": "John", "marbles": 100 }')

* Append an empty array named "xyz"
loJarr = CreateObject('Chilkat.JsonArray')
loJson.AppendArray2("xyz",loJarr)

? loJson.Emit()
* Expected output is:   {"name":"John","marbles":100,"xyz":[]}

* Add elements to the array.
loJarr.AddStringAt(-1,"hello")
loJarr.AddIntAt(-1,256)

? loJson.Emit()
* Expected output is:  {"name":"John","marbles":100,"xyz":["hello",256]}

RELEASE loJson
RELEASE loJarr