Check for malformed json sometimes coming from angular