I am unable to handle JSON decode errors. Here is my code:
try { $jsonData = file_get_contents($filePath) . \']\';
Another way to handle json decode error:-
if ($jsonObj === null && json_last_error() !== JSON_ERROR_NONE) { echo "json data is incorrect"; }