在php中提取json

hello,

There my ajax code

//If chkArray is not empty show the <div> and create the list
        if(chkArray.length !== 0) {
            $.ajax({
                method: 'POST',
                url : 'http://localhost/shop/ext/ajax/products_compare/test.php',
//                data : JSON.stringify({product_id: chkArray})
                data: {product_id: JSON.stringify(chkArray)},
            });
        }

I have a result like this :

array(1) {
  ["{"product_id":"]=>
  array(1) {
    [""10","9""]=>
    string(0) ""
  }
}

How to extract this code in php ?

There's no need to use JSON.stringify, just pass raw array of values:

$.ajax({
    method: 'POST',
    url : 'http://localhost/shop/ext/ajax/products_compare/test.php',
    data: {product_id: chkArray},
});

On serverside you will have $_POST['product_id'] array with values.