PowerBuilder
PowerBuilder
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
string ls_Big_cats
oleobject loo_Json
li_Success = 0
ls_Big_cats = "[~"lion~",~"tiger~",~"leopard~",~"jaguar~",~"cheetah~",~"snow leopard~",~"clouded leopard~",~"cougar~",~"puma~",~"panther~"]"
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
if li_rc < 0 then
destroy loo_Json
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Json.UpdateString("test","abc")
li_Success = loo_Json.NewArrayOf("big_cats",ls_Big_cats)
if li_Success = 0 then
Write-Debug loo_Json.LastErrorText
destroy loo_Json
return
end if
loo_Json.EmitCompact = 0
Write-Debug loo_Json.Emit()
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }
destroy loo_Json