Use try/catch when trying to parse JSON data received from an API