javascript JSON stringify and PHP JSON decode

//From client browser console, send JSON via POST request
jQuery.ajax({
 type: "POST",
 url: "proxy.php",
 data: JSON.stringify({
   arr: [1,2,3,4]   
 }),
 contentType: "application/json",
 dataType: 'json',
 success: function(res){console.log(res);}
}); 

//server side proxy.php
<?php
$obj = json_decode($HTTP_RAW_POST_DATA,true);//POST DATA decode
var_dump($obj);

What I expected is like

array(1) {
  ["arr"]=>
   array(4) {
   [0]=>
     int(1)
   [1]=>
     int(2)
   [2]=>
     int(3)
   [3]=>
    int(4)
   }
  }
}

but the result was

array(1) {
 ["arr"]=>
 string(12) "[1, 2, 3, 4]"
}

Problem was json_decode() does not recognise “[]” as array but just string.

Changed proxy.php code to

<?php
$d = str_replace('"[','[',$HTTP_RAW_POST_DATA);
$d = str_replace(']"',']',$d);
$obj = json_decode($d,true);
var_dump($obj);

Now, this works