diff --git a/lib/OpenLayers/Format/JSON.js b/lib/OpenLayers/Format/JSON.js index a61ecdb179..d15a713472 100644 --- a/lib/OpenLayers/Format/JSON.js +++ b/lib/OpenLayers/Format/JSON.js @@ -95,8 +95,9 @@ OpenLayers.Format.JSON = OpenLayers.Class(OpenLayers.Format, { * characters. */ try { - if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/. - test(json)) { + if (/^[\],:{}\s]*$/.test(json.replace(/\\["\\\/bfnrtu]/g, '@'). + replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). + replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { /** * In the second stage we use the eval function to compile the