从收到的POST数组中解码JSON

I sent POST request to my web-server with a few JSON-Params within the params there is an array. I receive for in the POST array-variable:

$ids = $_POST['id_arr'];     // contains: [{\"id\":12},{\"id\":13}]

I don't know how to parse this to an array in PHP. I tried to solve it with json_decode, but it seems like the wrong way.

My desired result is this: $ids = array(12, 13);

How can I do this?

You need to tell the json_decode function to convert the objects to associative arrays. As shown in the json_decode documentation, this can be done by setting to true the second argument:

$ids = json_decode($_POST['id_arr'], true);