Q:

Interpreting Javascript objects with literal notation/Object initializers in PHP

I made a PHP script to get an object initializer from a remote website using curl an the object looks like this
{'403' : {'3' : { qin : 144, qout : 52}, '4' : { qin : 143, qout : 86}, '5' : { qin : 144, qout : 79}, '6' : { qin : 143, qout : 93}, '7' : { qin : 144, qout : 78} }

¿Is there a function in PHP to interpret this or i need to use regular expressions?
Is not JSON valid but it's a valid Javascipt literal notation.

A:

Not to be used in production instead try and get a valid json output 
$json = "{'403' : {'3' : { qin : 144, qout : 52}, '4' : { qin : 143, qout : 86}, '5' : { qin : 144, qout : 79}, '6' : { qin : 143, qout : 93}, '7' : { qin : 144, qout : 78} }" ;

$json = preg_replace("/'(\w+)'/", '$1', $json); //remove all single quote
$json = preg_replace("/\s*([a-zA-Z0-9_]+)/", ' "$1"', $json);
$json .= "}"; // Missing End

var_dump($json,json_decode($json));

Output
object(stdClass)[1]
  public '403' => 
    object(stdClass)[2]
      public '3' => 
        object(stdClass)[3]
          public 'qin' => string '144' (length=3)
          public 'qout' => string '52' (length=2)
      public '4' => 
        object(stdClass)[4]
          public 'qin' => string '143' (length=3)
          public 'qout' => string '86' (length=2)
      public '5' => 
        object(stdClass)[5]
          public 'qin' => string '144' (length=3)
          public 'qout' => string '79' (length=2)
      public '6' => 
        object(stdClass)[6]
          public 'qin' => string '143' (length=3)
          public 'qout' => string '93' (length=2)
      public '7' => 
        object(stdClass)[7]
          public 'qin' => string '144' (length=3)
          public 'qout' => string '78' (length=2

