Closed MAC420965 closed 1 year ago
Could you elaborate on the error. Is it an exception? Where in the source code is the error raised?
I tried to reproduce it with you code snippet but I cannot. I am also using Delphi 11.1. I tried the Win64 both with and without the JSON_UTF8 define and with and without the JSON_STRING_INTERNING define, but I couldn't reproduce the error with any of these combinations.
I have this exception too, ERangeError in Neslib.Json.IO on line 1696, FIndentation is empty.
Sorry, I created this project with Range Checking turned off. I found a couple of ERangeError's when I turned range checking on. I think I got them all, but let me know if you still encounter other instances.
I also updated the Neslib submodule accordingly, so be sure you update the submodule as well or pull this repo recursively.
program StringifyJsonArray;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.SysUtils, Neslib.Json {latest version};
var doc: IJsonDocument; u: utf8string;
begin try doc := TJsonDocument.Parse('{"i":[-1,0,1]}'); u := doc.ToJson(false); // works if parameter is changed to true; tested with Delphi 11.1 and Win64 as target WriteLn(Utf8ToString(u)); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; ReadLn; end.