如何将URL编码的JSON数组转换为PHP数组

how can convert URL encoded JSON sent from my android application into PHP array.Current format i am getting looks like below format.

[{\\\"product_id\\\":\\\"33\\\",\\\"amount\\\":\\\"1\\\"},{\\\"product_id\\\":\\\"34\\\",\\\"amount\\\":\\\"3\\\"},{\\\"product_id\\\":\\\"10\\\",\\\"amount\\\":\\\"1\\\"}]

How can i convert those data into below format

product_id    amount
   33         1 
   34         3 
   10         1 

Because i want to insert those data into MySQL database.Can anyone please help me regarding this problem.

json_decode(jsonencoded string, TRUE) is correct way to encode json string.

But your json string encoded too deeper and recursive. your json encode string should as below

[{"product_id":9,"amount":500},{"product_id":9,"amount":500},{"product_id":9,"amount":500}]

Other wise, you will get NULL value

Use json_decode :

echo json_decode($jsonarr);

this can be done by json_decode

$json = '{"foo": 12345}';

$obj = json_decode($json);
print $obj->{'foo'}; // 12345

Good read

--- common mistakes using json_decode()