; CreateJsonArray Example
; -----------------------

; CreateJsonArray makes an empty JSON array - here, a hero's inventory
inventory=CreateJsonArray()
Print "New array, elements: "+JsonCount(inventory)

; Append some starting equipment (append copies the value,
; so each temporary handle is freed right after use)
v=CreateJsonString("sword")
JsonArrayAppend inventory,v
FreeJson v

v=CreateJsonString("shield")
JsonArrayAppend inventory,v
FreeJson v

v=CreateJsonString("potion")
JsonArrayAppend inventory,v
FreeJson v

Print "After looting, elements: "+JsonCount(inventory)
Print ""
Print "Inventory as JSON: "+JsonStringify(inventory,0)

FreeJson inventory

Print ""
Print "Press any key to close the example"
WaitKey

End
