Merge remote-tracking branch 'origin/develop' into develop
Conflicts: jsoneditor.js jsoneditor.map jsoneditor.min.js src/js/util.js
This commit is contained in:
commit
2c9b7e9c7b
|
@ -68,6 +68,16 @@ exports.sanitize = function (jsString) {
|
||||||
return $1 + '"' + $2 + '"' + $3;
|
return $1 + '"' + $2 + '"' + $3;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jsonString = jsonString.replace(/\/\*(.|[\r\n])*?\*\//g,'');//Remove all code comments
|
||||||
|
|
||||||
|
//If JSON starts with a function (Carachters/digist/"_-"), remove this function.
|
||||||
|
//This is usefull for "stripping" JSONP objects to become JSON
|
||||||
|
//For example: function_12321321 ( [{"a":"b"}] ); => [{"a":"b"}]
|
||||||
|
var match = jsonString.match(/^\s*[\dA-z_$]+\s*\(([\s\S]*)\)\s*;?\s*$/);
|
||||||
|
if (match) {
|
||||||
|
var jsonString = match[1];
|
||||||
|
}
|
||||||
|
|
||||||
return jsonString;
|
return jsonString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue