Just an idea, not mandatory:
Could we add a message here to say indicate that the response JSON could not be parsed?
Then we go on with the rest of the logic.