Exceptions parsing json string with comments and multiline comments TJSONParser in fpJson.
Original Reporter info from Mantis: DomingoGP @DomingoGP
-
Reporter name: Domingo Galmés
Original Reporter info from Mantis: DomingoGP @DomingoGP
- Reporter name: Domingo Galmés
Description:
Exception parsing the json string. WIthout the comment 2 works well.
Error message.
Invalid character at line 4 pos 0: '*'
Steps to reproduce:
procedure TTestParser.TestFirstLineLongComment;
// New case
const
ENDLINE = #$0d#$0a;
Const
MyJSON =
'/* long comment'+ENDLINE+
'''+ENDLINE+
' error'+ENDLINE+
'*/'+ENDLINE+
'{'+ENDLINE+
' "version":100, //coment2 without comment2 works well '+ENDLINE+
' "valor":200 /*comment 3'+ENDLINE+
' line 2'+ENDLINE+
' */'+ENDLINE+
'}'+ENDLINE;
var
J : TJSONData;
begin
With TJSONParser.Create(MyJSON,[joComments]) do
Try
J:=Parse;
J.Free;
Finally
Free;
end;
end;