; JsonErrorOffset Example ; ----------------------- ; Requires Extended mode. q$=Chr(34) ; Double-quote character, for building JSON text ; A one-line save-game corrupted mid-stream: 12x5 is not a number src$="{"+q+"player"+q+":"+q+"Aria"+q+","+q+"gold"+q+":12x5}" Print "Parsing this broken save-game:" Print src Print "" save=ParseJson(src) Print "ParseJson returned "+save+" (0 = failed): "+JsonError() Print "" ; JsonErrorOffset returns the ZERO-based UTF-8 byte offset of the ; error (-1 when unavailable) - useful for seeking in raw data offset=JsonErrorOffset() Print "JsonErrorOffset: "+offset Print "" ; Show the character sitting at that offset (Mid is one-based) Print "Character at offset "+offset+": '"+Mid(src,offset+1,1)+"'" Print "" Print "Press any key to close the example" WaitKey End