Commit Graph

7 Commits

Author SHA1 Message Date
Stephen Thompson 48408f4ded Fix https://github.com/josdejong/jsoneditor/issues/314
The JSON path parsing code assumes that string keys within square brackets in JSON paths will be valid, parseable JSON.

However, the ajv library on which this project depends emits string keys in single quotes.

For example, ajv can emit .foo['bar'], which will ultimately end up with a call to JSON.parse("'bar'"). This causes the "Unexpected token ' in JSON at position 0" error thrown from JSON.parse.

 Since ajv shouldn't need to change and since this utility is gone in the next branch, this fix checks for ajv-formatted string keys and patches them to double-quoted strings before calling JSON.parse. This is the narrowest fix for the problem.
2016-09-22 18:06:22 -04:00
jos 8f7b656c3c Extended `util.parsePath` with support for all '*' 2016-04-04 21:28:23 +02:00
jos 8ec471b6dc Improvements in sanitizing invalid JSON 2016-01-16 14:49:04 +01:00
jos 4b5ac7434f Parent nodes now display an error when a child node is invalid 2016-01-11 17:06:12 +01:00
jos 75372fa3d7 More unit tests and a refinement of the regexp to remove JSONP encapsulation 2015-02-28 17:03:40 +01:00
jos b94b87c66b Fixed bugs in the JSON sanitizer, no longer manipulating comments or JSON-like structures inside strings. 2015-02-28 16:54:34 +01:00
jos 86e15f74e2 Added some unit tests 2015-02-28 15:04:46 +01:00