API calls return json in case of errors too.