API Response Validator
What It Is
This tool parses raw HTTP responses - headers and JSON body - into structured, readable output and generates TypeScript interfaces and JSON schemas from the body. Developers use it during API integration, debugging third-party endpoints, and validating JSON syntax without installing curl, Postman, or any desktop tool. Everything runs client-side with no server uploads.
How It Works
The parser uses a smart divider that scans for the first [ or { character to split headers from JSON body. The status line is extracted via regex (HTTP/\d(?:\.\d)?\s+(\d{3})) and header key-value pairs are parsed with index-of-colon. The JSON body goes through JSON.parse() for validation, then JSON.stringify(parsed, null, 2) for formatting. If parsing fails, the error position is extracted to compute line and column numbers for pinpointing the syntax issue.
Worked Example
Input: Paste a raw 422 response:
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json
{
"error": "validation_failed",
"errors": [
{"field": "email", "reason": "Must be a valid email address."}
]
}Output: Status code 422 parsed with description "Unprocessable Entity." Headers table shows Content-Type: application/json. The JSON body is validated, pretty-printed, and displayed with syntax highlighting. Switch to the Status Guide tab to see causes (validation constraints failed) and fixes (inspect response body for field-level errors). The Types tab generates the TypeScript interface with error: string and errors: Array<{field: string; reason: string}>.
Common Mistakes
- Omitting the Content-Type header. Some APIs omit this header in error responses. The tool will still parse the body correctly, but you lose the context that the body is JSON rather than plain text.
- Confusing 4xx and 5xx debugging steps. A 401 (Unauthorized) means your request lacks valid credentials - check the Authorization header. A 502 (Bad Gateway) means the server infrastructure is failing - check upstream services, not your request payload.
- Pasting response body without headers. The tool handles body-only input, but without headers you lose status code detection and header-level metadata (e.g., caching directives, rate-limit headers).
Frequently Asked Questions
Q:Does my API response data get uploaded to any servers?
No, all response parsing, JSON formatting, validation, and schema generation happen 100% locally in your web browser. No data ever leaves your device.
Q:Can I paste raw cURL output or terminal responses?
Yes! The auto-parser is designed to split headers and JSON bodies dynamically. Just copy the entire raw output and paste it into the input area.
Q:Why does it highlight a JSON syntax error?
JSON (JavaScript Object Notation) has strict syntax rules. Common errors include using single quotes instead of double quotes, missing commas between elements, or trailing commas at the end of objects.
Q:Can I generate TypeScript types from any JSON response?
Yes. The codegen tab produces a TypeScript interface that matches the structure of the JSON response body. It handles nested objects, arrays, and primitive types automatically. Simply paste valid JSON and switch to the Types & Schema tab.
Q:What HTTP status codes are covered by the guide?
The status guide includes detailed entries for 24 common codes from 100 Continue through 504 Gateway Timeout, plus fallback descriptions for any unrecognized 1xx/2xx/3xx/4xx/5xx code. Each entry explains the meaning, common causes, and specific debugging steps.