; JsonCount Example ; ----------------- ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; A save-game with an inventory array inside an object src$="{"+q+"player"+q+":"+q+"Aria"+q+","+q+"level"+q+":7," src=src+q+"inventory"+q+":["+q+"sword"+q+","+q+"shield"+q+","+q+"potion"+q+"]}" save=ParseJson(src) ; On an object, JsonCount is the number of properties Print "Save-game: "+JsonStringify(save,0) Print "Fields in the save object: "+JsonCount(save) ; On an array, JsonCount is the number of elements inventory=JsonObjectGet(save,"inventory") Print "Items in the inventory: "+JsonCount(inventory) Print "" Print "Aria carries "+JsonCount(inventory)+" items." FreeJson inventory FreeJson save Print "" Print "Press any key to close the example" WaitKey End