Thanks for looking!
I am writing some front-end code that consumes a JSON service which is returning malformed JSON. Specifically, the keys are n
something like this may help to repair the json ..
$str='{foo:"bar"}'; echo preg_replace('/({)([a-zA-Z0-9]+)(:)/','$1"$2"${3}',$str);
Output:
{"foo":"bar"}
EDIT:
var str='{foo:"bar"}'; str.replace(/({)([a-zA-Z0-9]+)(:)/,'$1"$2"$3')