Handle invalid JSON instead of infinite looping.