Better handle JSON parsing failures in the rest API.