Merge pull request #326 from nprdm/master
Fix https://github.com/josdejong/jsoneditor/issues/314
This commit is contained in:
commit
b4c9417b7a
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* @author Jos de Jong, <wjosdejong@gmail.com>
|
||||
* @version 5.5.7
|
||||
* @date 2016-08-17
|
||||
* @date 2016-09-22
|
||||
*/
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
|
@ -2702,6 +2702,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
|
||||
var value = jsonPath.substring(1, end);
|
||||
if (value[0] === '\'') {
|
||||
// ajv produces string prop names with single quotes, so we need
|
||||
// to reformat them into valid double-quoted JSON strings
|
||||
value = '\"' + value.substring(1, value.length - 1) + '\"';
|
||||
}
|
||||
|
||||
prop = value === '*' ? value : JSON.parse(value); // parse string and number
|
||||
remainder = jsonPath.substr(end + 1);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* @author Jos de Jong, <wjosdejong@gmail.com>
|
||||
* @version 5.5.7
|
||||
* @date 2016-08-17
|
||||
* @date 2016-09-22
|
||||
*/
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
|
@ -10601,6 +10601,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
|
||||
var value = jsonPath.substring(1, end);
|
||||
if (value[0] === '\'') {
|
||||
// ajv produces string prop names with single quotes, so we need
|
||||
// to reformat them into valid double-quoted JSON strings
|
||||
value = '\"' + value.substring(1, value.length - 1) + '\"';
|
||||
}
|
||||
|
||||
prop = value === '*' ? value : JSON.parse(value); // parse string and number
|
||||
remainder = jsonPath.substr(end + 1);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -661,6 +661,12 @@ exports.parsePath = function parsePath(jsonPath) {
|
|||
}
|
||||
|
||||
var value = jsonPath.substring(1, end);
|
||||
if (value[0] === '\'') {
|
||||
// ajv produces string prop names with single quotes, so we need
|
||||
// to reformat them into valid double-quoted JSON strings
|
||||
value = '\"' + value.substring(1, value.length - 1) + '\"';
|
||||
}
|
||||
|
||||
prop = value === '*' ? value : JSON.parse(value); // parse string and number
|
||||
remainder = jsonPath.substr(end + 1);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ describe('util', function () {
|
|||
assert.deepEqual(util.parsePath('.foo[2]'), ['foo', 2]);
|
||||
assert.deepEqual(util.parsePath('.foo[2].bar'), ['foo', 2, 'bar']);
|
||||
assert.deepEqual(util.parsePath('.foo["prop with spaces"]'), ['foo', 'prop with spaces']);
|
||||
assert.deepEqual(util.parsePath('.foo[\'prop with single quotes as outputted by ajv library\']'), ['foo', 'prop with single quotes as outputted by ajv library']);
|
||||
assert.deepEqual(util.parsePath('.foo[*].bar'), ['foo', '*', 'bar']);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue