Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.4.0+

Example: JsonObject.NewArrayOf method

See more JSON Examples

Demonstrates the NewArrayOf method.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL cBig_cats
LOCAL oJson

nSuccess := 0

cBig_cats := '["lion","tiger","leopard","jaguar","cheetah","snow leopard","clouded leopard","cougar","puma","panther"]'

oJson := CreateObject("Chilkat.JsonObject")

oJson:UpdateString("test", "abc")

nSuccess := oJson:NewArrayOf("big_cats", cBig_cats)
IF (nSuccess == 0)
    ? oJson:LastErrorText
    oJson:destroy()
    RETURN
ENDIF

oJson:EmitCompact := 0
? oJson:Emit()

//  Result:

//  {
//    "test": "abc",
//    "big_cats": [
//      "lion",
//      "tiger",
//      "leopard",
//      "jaguar",
//      "cheetah",
//      "snow leopard",
//      "clouded leopard",
//      "cougar",
//      "puma",
//      "panther"
//    ]
//  }

oJson:destroy()