in reply to Re^2: Quick 'n dirty extraction of JSON from an HTML page
in thread Quick 'n dirty extraction of JSON from an HTML page

Consider using the original regexp, which doesn't require keys to be quoted, and parsing the JSON using Cpanel::JSON::XS and turning relaxed mode.

Javascript objects can of course still include values which cannot be encoded into JSON, for example:

var obj = { "some_key": Date.now(), "other_key": function () { console.log("Hello world"); } };

So if your Javascript objects contain things like this, you'll be out of luck. You might want to wrap your JSON decoding in try/catch or eval.