Ajax请求。 服务器返回null

JavaScript file. #form - html form. In var data - objects

    $(document).ready(function() {
      $('#form').submit(function (e) {
        e.preventDefault();
        var data = $('#form').serializeArray();
        $.ajax({
            type: "POST",
            url: "... .php",
            data: data,
            dataType: "json",
            success: function(d) {
                ...

            },
            error: function(xhr, status, error) {
                alert(xhr.responseText + '|
' + status + '|
' +error);
            }
        });
    }); 
}); 

Php file

$data =  json_decode($_POST['data']);
$dataJson = json_encode($data);
echo $dataJson;

Server returned Null. Why?

Why you decode $_POST['data']? All your form fields have prefix data?

Try this

$data = json_decode($_POST, true); // parse to array

echo json_encode($data);