-
-
Notifications
You must be signed in to change notification settings - Fork 102
Description
Description
The server produces invalid json for a settings get request if the raw setting text includes a value allowed by JSON5, but not by JSON (such as Infinity)
Reproduce
Add a user-level setting, such as Notebook.numberCellsToRenderDirectly, and set it to Infinity. This is a value that is allowed by JSON5, but is not allowed by JSON. Then start JupyterLab and note the many errors in the console about not being able to parse the results of the settings request.
Basically, this line adds converts the JSON5 raw setting to JSON:
settings = json5.loads(raw) |
It does a pretty good job of stripping comments, etc, but it leaves in the Infinity. Python can serialize Infinity just fine, but the browser chokes on the response, giving an error like
JSON.parse: unexpected character at line 1 column 25047 of the JSON data
Since we've standardized on JSON5, I think perhaps we should not try to include a parsed version of the setting. Instead, just send the raw text over and do a json5 conversion in the browser.
Expected behavior
Infinity to be properly recognized by the setting system.
Context
- Operating System and version: macOS Catalina
- Browser and version: Firefox 92
- JupyterLab version: 3.2 unreleased master