Okay, can you please modify the function so that it checks the JSON format for errors so that the Python script continues to work even if the JSON file is invalid?