; JsonObjectHas Example ; --------------------- ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; A loaded save-game record save=ParseJson("{"+q+"player"+q+":"+q+"Aria"+q+","+q+"gold"+q+":1250}") Print "Save-game: "+JsonStringify(save,0) Print "" ; JsonObjectHas tests for an exact key without creating a copy ; and without disturbing JsonError when the key is absent Print "Has 'player'? "+JsonObjectHas(save,"player") Print "Has 'gold'? "+JsonObjectHas(save,"gold") Print "Has 'mount'? "+JsonObjectHas(save,"mount") Print "" ; Typical use: probe before reading an optional field If JsonObjectHas(save,"mount") Print "Loading the mount..." Else Print "No mount saved - Aria travels on foot." EndIf FreeJson save Print "" Print "Press any key to close the example" WaitKey End