Skip to main content

Convert an HTTP Header List into JSON, CSV, and TypeScript in One Step

Turn a pasted list of HTTP headers into JSON, CSV, Markdown, SQL IN, or a TypeScript union for API clients and request configs, all parsed locally in your browser.

Published By Li Lei
#http-headers #api #developer-tools #json #typescript

Convert an HTTP Header List into JSON, CSV, and TypeScript in One Step

Every API client starts with the same chore. You copy a block of Name: value headers out of a request inspector, an API doc, or a colleague's Slack message, and now you need that same block as a JSON object for a config file, or as a typed union for an SDK, or as a CSV row for a tracking sheet. Reformatting each line by hand is slow and error-prone: a missing comma here, a stray quote there, and the whole config breaks on first run.

The HTTP Header List Converter reads that pasted block once and re-emits the exact same header set in whichever shape your next tool expects. The parser runs entirely in the browser, so the tokens you copied from a request never leave your machine.

The formats this tool actually outputs

Be precise about what you get, because that is what you will paste downstream. From one parsed header list, this converter produces six outputs:

  • Plain lines — the normalized list, one header per line.
  • JSON — the parsed rows as a JSON structure you can drop into a config file or fixture.
  • CSV — columns you can open in a spreadsheet or feed to a script.
  • Markdown — a table for a review doc or a pull request.
  • SQL IN — a quoted, comma-separated set ready for a WHERE … IN (…) clause.
  • TypeScript union — a union of string literals for typing a header map or allowlist.

That is the full menu. The tool does not emit a curl -H command string or a ready-made fetch() options object; if you need those, you take the JSON or plain-line output and wire it into your own request code. Knowing the real output set keeps you from hunting for a button that was never there.

On top of the format switch, you can keep unique rows only, preserve invalid rows for review, and sort the normalized output before exporting. Sensitive profiles such as cards and JWTs mask their values in the output while still reporting whether each row parsed cleanly.

From a captured header set to a typed config

Here is the move that saves the most time. You captured a header set from a request inspector, it looks like this:

Content-Type: application/json
Authorization: Bearer abc123
Accept: application/json
X-Request-Id: 9f2c

Paste it in, leave it on JSON output, and you get a structured object you can lift straight into a client config or a test fixture:

[
  { "name": "Content-Type", "value": "application/json", "line": 1, "valid": true },
  { "name": "Authorization", "value": "Bearer abc123", "line": 2, "valid": true },
  { "name": "Accept", "value": "application/json", "line": 3, "valid": true },
  { "name": "X-Request-Id", "value": "9f2c", "line": 4, "valid": true }
]

Now flip the same four lines to the TypeScript union output and you have a literal type for the header names — useful when you want an allowlist that the compiler enforces:

type HeaderName =
  | "Content-Type"
  | "Authorization"
  | "Accept"
  | "X-Request-Id";

Two outputs, same input, zero manual quoting. That is the whole point: pick the format your next file wants, copy, paste, move on.

Why keeping the line numbers matters

Header lists collected by hand are uneven. An Authorization line with no value, a duplicated Accept, or Content Length written with a space instead of a hyphen all sneak in when you copy from logs, support tickets, or a rendered web page. This tool can keep those invalid rows in the output and tell you which line each one came from and why it failed, so you can jump back to the source and fix it rather than silently dropping it.

If you only want the clean set, turn on unique rows and sort, and the noise collapses into a tidy list. If you are building an audit trail, export CSV or Markdown with the line numbers intact instead of copying only the final list — that is the artifact a reviewer can actually check.

How I use it in a real client build

The first time this earned its place in my workflow was during an integration where the vendor shipped their required headers as a screenshot pasted into a ticket. I OCR'd it, pasted the messy result here, and immediately saw two rows flagged invalid — a header with a trailing space and one with a missing value, both artifacts of the screenshot. I fixed those at the source, switched to JSON for the request config, then switched to SQL IN to seed an allowlist table the gateway checks against. One paste, three artifacts, and I never typed a quote or a comma myself. What would have been ten minutes of careful retyping became about thirty seconds, and the validation caught a bug I would otherwise have shipped.

Where it fits with the other header tools

This converter is the format-switching front door to a small family of single-purpose tools. When you only need one job done, reach for the specialist:

A common chain is extract, normalize, dedupe, then bring the result here to convert into the shape your client or config needs.

A few things to remember

Valid format is not proof of truth. A header that parses cleanly tells you nothing about whether the token works or the endpoint exists — it only tells you the line is well-formed. Treat the validation as a syntax check, not an auth check.

Copied web text often carries hidden whitespace, so normalize before you deduplicate or import, or you will end up with rows that look identical but compare as different. And this tool is built for short lists — a few dozen headers for an API client, not a fleet-wide export of every header ever seen. If you have a massive dump, chunk it locally before converting.

Once those habits are second nature, converting a header list stops being a copy-and-retype tax and becomes a single paste. Open the HTTP Header List Converter, drop in your headers, and pick the output your code already wants.


Made by Toolora · Updated 2026-06-13