; JsonText Example ; ---------------- ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; Load a save-game and read the player's name back out save=ParseJson("{"+q+"player"+q+":"+q+"Aria"+q+","+q+"guild"+q+":"+q+"Night Owls"+q+"}") name_value=JsonObjectGet(save,"player") ; Check the kind before a strict getter - JsonText on a ; non-string kind is a programming error If JsonKind(name_value)=JSON_STRING Print "Welcome back, "+JsonText(name_value)+"!" Else Print "Save is corrupt: 'player' is not a string" EndIf ; Strings come back as strict UTF-8, exactly as stored guild_value=JsonObjectGet(save,"guild") Print "Guild: "+JsonText(guild_value) FreeJson guild_value FreeJson name_value FreeJson save Print "" Print "Press any key to close the example" WaitKey End