I'm working on a careers listing page for our company. We are using an API to retrieve the information from our HR software provider. The JSON appears to be invalid. I'm using the below to test it.
<?php
//Testing if ADPs json is valid
$json = json_decode($jsondata);
if (json_last_error() === JSON_ERROR_NONE) {
// $json contains a valid json string. It's ready to use.
print_r($jobdata);
} else {
// oops, it's not valid JSON.
echo '<h2>'.'We\'re sorry. We are unable to list jobs right now. Please contact'.' <a href="mailto:careers@domain.com">careers@domain.com</a>'.'</h2>';
}
?>
Is there a way I can parse the invalid JSON? It appears that there is an unexpected bracket somewhere.