CkPython
CkPython
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat CkPython Downloads
import sys
import chilkat
success = False
big_cats = "[\"lion\",\"tiger\",\"leopard\",\"jaguar\",\"cheetah\",\"snow leopard\",\"clouded leopard\",\"cougar\",\"puma\",\"panther\"]"
json = chilkat.CkJsonObject()
json.UpdateString("test","abc")
success = json.NewArrayOf("big_cats",big_cats)
if (success == False):
print(json.lastErrorText())
sys.exit()
json.put_EmitCompact(False)
print(json.emit())
# Result:
# {
# "test": "abc",
# "big_cats": [
# "lion",
# "tiger",
# "leopard",
# "jaguar",
# "cheetah",
# "snow leopard",
# "clouded leopard",
# "cougar",
# "puma",
# "panther"
# ]
# }