Adding try catch block to catch invalid json