September 06, 2014 [Issue 13432] New: std.json.parseJSON does not report correct line number in Exception | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: murphyslaw480@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 -- |
Copyright © 1999-2021 by the D Language Foundation