I'm sending a JSON with the POST AJAX method to a PHP file and I would like to know how can I check if the JSON is correctly sent before using the json_decode
function ?
The isset($_POST['myJSON'])
and !empty($_POST['myJSON'])
functions are they correct for this case or I cannot use them because my variable is a JSON?
You can check by using JavaScript function JSON.parse($val)
before sending to php file
If it shows error then your json is not correct