Because you’re passing a JSON blob via a POST request, you’ll need to decode the JSON before attempting to read the data in it. You should also use PHP’s Filter Functions to safely retrieve user input.