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
It seems that from version 0.14.4 onwards an error is thrown after clicking the "Show me" action button when the editor is modified in "Text" mode to contain certain invalid JSON.
The linked codesandbox is the React playground example provided in this library's README.
To reproduce, perform the following steps:
ensure you are using version 0.14.4 or later
change to "text" mode
modify the true value to tru
an error alert should appear and the first character of the entire JSON text (not where the error is) should be identified in red
click the "Show me" button in the error alert (or click the error message itself)
the following error should be thrown: Cannot read properties of undefined (reading 'length')
Another example that causes this would be adding a letter at the end of line 6 (or 7, or 8, etc.), though adding a number works fine.
If you switch to version 0.14.3, this error is not thrown and your cursor is moved to where the red error is.
Looking at the release history, it seems the "Show me" button was first added in 0.14.4.
I also noticed that when modifying the JSON to be in the invalid state, the ContentParseError object provided inside the third argument of the onChange event contains null values for column, line, and position. This is the case for both 0.14.3 and 0.14.4 onwards.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. I could reproduce the issue on Chrome (doesn't happen on Firefox).
In most cases, parse error messages look like the following:
Uncaught SyntaxError: Expected ',' or '}' after property value in JSON at position 22
You see that the error reports the position where the error occurred. The exact error message and way of reporting the position differs though between the different browsers. JSONEditor normalizes this, and when found, fills in these values in the ParseError object. If not found, it leaves column, line and positionnull. The case you found is an error without position information:
Unexpected token ',', ..."lean": tru,
"color"... is not valid JSON
The "Show me" button wasn't reconing with the fact that position may be null. I've now fixed this via d839e95 (Not yet published)
It seems that from version 0.14.4 onwards an error is thrown after clicking the "Show me" action button when the editor is modified in "Text" mode to contain certain invalid JSON.
https://codesandbox.io/s/svelte-jsoneditor-react-forked-qz65tt
The linked codesandbox is the React playground example provided in this library's README.
To reproduce, perform the following steps:
true
value totru
Cannot read properties of undefined (reading 'length')
Another example that causes this would be adding a letter at the end of line 6 (or 7, or 8, etc.), though adding a number works fine.
If you switch to version 0.14.3, this error is not thrown and your cursor is moved to where the red error is.
Looking at the release history, it seems the "Show me" button was first added in 0.14.4.
I also noticed that when modifying the JSON to be in the invalid state, the ContentParseError object provided inside the third argument of the onChange event contains null values for
column
,line
, andposition
. This is the case for both 0.14.3 and 0.14.4 onwards.The text was updated successfully, but these errors were encountered: