Skip to content

Commit

Permalink
feature josdejong#144
Browse files Browse the repository at this point in the history
  • Loading branch information
yanivefraim committed Feb 11, 2015
1 parent abc3ac3 commit e4c5657
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
13 changes: 12 additions & 1 deletion jsoneditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Jos de Jong, <[email protected]>
* @version 3.2.0
* @date 2015-01-25
* @date 2015-02-10
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
Expand Down Expand Up @@ -1481,6 +1481,17 @@ return /******/ (function(modules) { // webpackBootstrap
return $1 + '"' + $2 + '"' + $3;
});

//Strips only jQuery's JSONP
// if(jsonString.match(/.*jQuery.+?\(/)){
// var jsonStringTemp = jsonString.replace(/.*jQuery.+?\(/,'');
// jsonString = jsonStringTemp.replace(/\)(?!.*\));?/g,'');
// }

//Clear json's surrounding (for example: 123{"a":"b"}456 => {"a":"b"})
jsonString = jsonString.replace(/[^{]*/,'');//remove all characters before first "{" (match first not '{')

jsonString = jsonString.replace(/([^}])(?!.*(\}))/g,'');//remove all characters after last "}" (match first not '}' which does not have following '}')

return jsonString;
};

Expand Down
2 changes: 1 addition & 1 deletion jsoneditor.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions jsoneditor.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ define(function () {
return $1 + '"' + $2 + '"' + $3;
});

//Strips only jQuery's JSONP
// if(jsonString.match(/.*jQuery.+?\(/)){
// var jsonStringTemp = jsonString.replace(/.*jQuery.+?\(/,'');
// jsonString = jsonStringTemp.replace(/\)(?!.*\));?/g,'');
// }

//Clear json's surrounding (for example: 123{"a":"b"}456 => {"a":"b"})
jsonString = jsonString.replace(/[^{]*/,'');//remove all characters before first "{" (match first not '{')

jsonString = jsonString.replace(/([^}])(?!.*(\}))/g,'');//remove all characters after last "}" (match first not '}' which does not have following '}')

return jsonString;
};

Expand Down

0 comments on commit e4c5657

Please sign in to comment.