Created attachment 1419
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
Comment #1 by ryan — 2014-09-06T14:49:45Z
Created attachment 1420
code to parse json and throw exception
Comment #2 by pastuhov85 — 2015-05-17T08:56:50Z
It seems thant all json is minified before being processed, so example above seen as
{"key":{"val1":1,"val2":2},}
by Phobos, and the error is on line 1, colimn 29 from this point of view.
Comment #3 by mvalleton.dlang — 2016-01-08T18:54:16Z
*** This issue has been marked as a duplicate of issue 14065 ***