Debugger: JSon expand - allow non-strict json

This commit is contained in:
Martin 2022-07-29 23:21:11 +02:00
parent d85e87e54f
commit c5e879e4e5
2 changed files with 12 additions and 4 deletions

View File

@ -231,13 +231,13 @@ function TWatchValue.GetResultData: TWatchResultData;
if l = 0 then
exit;
while (l > 1) and (s[l] in [' ', #9]) do
while (l > 1) and (s[l] in [' ', #9, #10, #13]) do
dec(l);
if not(s[l] in [']', '}']) then
exit;
i := 1;
while (i < l) and (s[i] in [' ', #9]) do
while (i < l) and (s[i] in [' ', #9, #10, #13]) do
inc(i);
if not(s[i] in ['[', '{']) then
exit;

View File

@ -5,7 +5,7 @@ unit IdeDebuggerWatchResultJSon;
interface
uses
Classes, SysUtils, IdeDebuggerWatchResult, fpjson, jsonparser;
Classes, SysUtils, IdeDebuggerWatchResult, fpjson, jsonparser, jsonscanner;
type
@ -49,10 +49,18 @@ implementation
{ TWatchResultDataJSonBase }
function TWatchResultDataJSonBase.JSon: TJSONData;
Var
P : TJSONParser;
begin
if FInternalJSon = nil then
try
FInternalJSon := GetJSON(AsString);
//FInternalJSon := GetJSON(AsString);
P := TJSONParser.Create(AsString, [joUTF8,joComments,joIgnoreTrailingComma,joBOMCheck{,joIgnoreDuplicates}]);
try
FInternalJSon := P.Parse;
finally
P.Free;
end;
except
FInternalJSon := nil;
end;