notebook
notebook copied to clipboard
JSON parsing fails too hard
Description
Although the JSON spec does not allow comments, plenty of JSON files have comments in them anyway, e.g.
{
"serverlist":
["us-east-1","us-west-1","sea-2"],
//must be a string not an integer
"userid": "13317025461942"
}
and plenty of parsers accept (and ignore) these. In Jupyter 6.x, this was fine, and we could edit our .JSON files in Jupyter as a text editor. In Jupyter 7, it seems that the JSON parsing has gotten "smarter". While that's fine and well, it then refuses to give a basic text editor.
The user is just met with "JSON.parse: expected property name or '}' at line 2 column 1 of the JSON data" if there's a comment on the second line. And then no editing functionality is available at all, not even just to fix the file. The only option is to rename the file to .txt, edit like that, and then move the file back to .json.
Reproduce
Create a file named "foo.json" with the body
{
//hi
"a":5}
and open it in Jupyter. Jupyter gives a parse error and then displays no editor.
Expected behavior
Jupyter should give a fallback plain-text editor.
Context
@Timeroot, there is already an option to open the JSON files with text editor.