; JsonBoolean Example ; ------------------- ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; Load a save-game that stores a difficulty flag save=ParseJson("{"+q+"player"+q+":"+q+"Aria"+q+","+q+"hardcore"+q+":true}") ; Fetch the flag (child getters return an owned copy) flag=JsonObjectGet(save,"hardcore") ; Check the kind before using a strict getter on untrusted data - ; JsonBoolean on a non-Boolean is a programming error If JsonKind(flag)=JSON_BOOLEAN Print "hardcore flag = "+JsonBoolean(flag) If JsonBoolean(flag) Then Print "Permadeath is ON - good luck, Aria!" Else Print "Save is corrupt: 'hardcore' is not a Boolean" EndIf FreeJson flag FreeJson save Print "" Print "Press any key to close the example" WaitKey End