[Issue 13432] New: std.json.parseJSON does not report correct line number in Exception
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Sep 6 07:48:34 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13432
Issue ID: 13432
Summary: std.json.parseJSON does not report correct line number
in Exception
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: minor
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: murphyslaw480 at gmail.com
Created attachment 1419
--> https://issues.dlang.org/attachment.cgi?id=1419&action=edit
simple json file with syntax error
When std.json.parseJSON is called on a string containing invalid JSON, the
returned exception always reports a syntax error on line number 1. The column
number seems to give the total number of characters parsed up to the point of
the error rather than the number of preceding characters on that line.
For example, calling parseJSON on the following:
{
"key" : {
"val1" : 1,
"val2" : 2
}, <------ syntax error on line 5, column 4
}
throws an exception that reports
'Found '}' when expecting '"'. (Line 1:29)'
To parse, I am using "test.json".readText.parseJSON
--
More information about the Digitalmars-d-bugs
mailing list