Visual FoxPro
Visual FoxPro
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL lcBig_cats
LOCAL loJson
lnSuccess = 0
lcBig_cats = '["lion","tiger","leopard","jaguar","cheetah","snow leopard","clouded leopard","cougar","puma","panther"]'
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("test","abc")
lnSuccess = loJson.NewArrayOf("big_cats",lcBig_cats)
IF (lnSuccess = 0) THEN
? loJson.LastErrorText
RELEASE loJson
CANCEL
ENDIF
loJson.EmitCompact = 0
? loJson.Emit()
* Result:
* {
* "test": "abc",
* "big_cats": [
* "lion",
* "tiger",
* "leopard",
* "jaguar",
* "cheetah",
* "snow leopard",
* "clouded leopard",
* "cougar",
* "puma",
* "panther"
* ]
* }
RELEASE loJson