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

Example: JsonObject.NewArrayOf method

See more JSON Examples

Demonstrates the NewArrayOf method.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

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

loJson = createobject("CkJsonObject")

loJson.UpdateString("test","abc")

llSuccess = loJson.NewArrayOf("big_cats",lcBig_cats)
if (llSuccess = .F.) then
    ? loJson.LastErrorText
    release loJson
    return
endif

loJson.EmitCompact = .F.
? loJson.Emit()

//  Result:

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


release loJson