I have json data represented like this
{key:\"value\"}
(no quotes arround key...)
I want to translate it to an associative array.>
This worked for me, using regex replace '/\s(\w+)\s/i'
$json = file_get_contents("php://input"); // or whatever json data $json = preg_replace('/\s(\w+)\s/i', '"$1"', $json); $json = json_decode($json, true);