Issue reading HTTP request body from a JSON POST in PHP

Solution 1:

Thanks to others for the input. It turns out that I just needed

$inputJSON = file_get_contents('php://input');
$input = json_decode($inputJSON, TRUE); //convert JSON into array

where the second parameter in json_decode returned the object as an array.

Hope this helps someone else!

Solution 2:

Even when the following works.

$inputJSON = file_get_contents('php://input');

If you want to continue using $_POST send the data as FormData

var fd = new FormData();
fd.append('key', 'value');
return axios.post('url', fd)