You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using jju to provide more helpful errors when parsing invalid JSON files. I noticed that sometimes the clues about the location of the error (line:column) are off and it seems it mostly adds 1 to either the line or the column.
Here's an example of the column index being off:
Why is the caret at 3:3? The string ends with '}' which is located at 3:1 so I expect the end of input to be at 3:2. Also if you look at the output the ^ is pointing to the next character after '}' so that also seems to suggest the location should be 3:2.
Here's another case that I find a bit confusing, when you parse this:
{
"a": "b",
"c": 5,
}
You get:
Trailing comma in object at 4:1
}
^
The trailing comma is at the end of the third line and not at the beginning of the fourth line. In this case I understand the index, since 4:1 is the point where the parse actually failed. That said, I find it confusing that we say the issue is a "Trailing comma in object at", but instead of telling the user where that comma is located, we give the index of the closing curly brace. If you add some extra new lines before the closing brace the index would change accordingly, even due the actual problem, the trailing comma, is at the same location.
I'm using
jju
to provide more helpful errors when parsing invalid JSON files. I noticed that sometimes the clues about the location of the error (line:column) are off and it seems it mostly adds 1 to either the line or the column.Here's an example of the column index being off:
When I run it I get:
The end of input is at 3:2 and not 3:3. Am I missing something?
The text was updated successfully, but these errors were encountered: