SublimeLinter-json icon indicating copy to clipboard operation
SublimeLinter-json copied to clipboard

Trailing Commas on Array Elements Don't Throw Exceptions

Open JoshMayberry opened this issue 4 years ago • 1 comments

This is a different issue than https://github.com/SublimeLinter/SublimeLinter-json/issues/11. A trailing comma in an array element is not caught. For example,

[
    {
        "banana": true
    },
]

and

[
    "banana",
]

Will not throw an error.

JoshMayberry avatar Mar 23 '21 17:03 JoshMayberry

Yes, that's correct and basically #20. The internal python3.3 json module does not report anything of value in this cases, it reports "No JSON object could be decoded" without telling a line nor a column. Using simplejson as in #20 would resolve this. (We probably could report an error on line 1 col 1 just to indicate the error but that wouldn't help the user in finding it.)

If we ever can use python3.8 in an upcoming Sublime Text version, this would solve the issue as well because it ships the better json parser. Not sure what to do here.

kaste avatar Mar 25 '21 11:03 kaste