Skip to content
toolbelt
Back to Guides

How I Actually Read a Messy API Response

By ·

Updated

You paste a wall of JSON from a network tab and need to see its shape. Here is how formatting helps, and the mistakes I make most often.

What is this tool?

JSON is how almost every API replies. The trouble is that the wire format is a single line with no whitespace, because saving bytes used to matter. A formatter puts the indentation back so you can see what you are dealing with.

How it works

The tool runs your text through the browser's own JSON parser. If it parses, it re-prints the same data with two spaces per level. Nothing is added, removed or reordered — if the values come out different from the values that went in, that is a bug, not a feature. If it does not parse, you get the position where the parser gave up, in line and column, because "Unexpected token" on its own tells you nothing useful.

Example

What you paste:
{"id":42,"user":{"name":"Ada","roles":["admin","dev"]},"ok":true}

What you get back:
{
  "id": 42,
  "user": {
    "name": "Ada",
    "roles": [
      "admin",
      "dev"
    ]
  },
  "ok": true
}

When to use it

The moment you copy something out of a network tab, a webhook delivery log, or a config file someone else wrote. Also worth doing before you paste JSON into a ticket or a chat message, so the person reading it does not have to reformat it themselves.

Optimization Tips

Reformat first, then read. A surprising number of "the API returned the wrong field" bugs turn out to be a trailing comma or a missing bracket a few hundred characters in. If the formatter fails, jump straight to the reported line rather than scanning the whole payload.

Frequently Asked Questions

Did formatting change my data?
No. Whitespace is the only thing that changes. Same keys, same order, same values.
Why does my JSON fail here but work in JavaScript?
JavaScript object literals allow trailing commas and single quotes. Strict JSON does not. You are probably pasting a JS object, not JSON.
Is my payload uploaded anywhere?
No. Parsing happens in your tab. You can pull the network cable out and it still works.
What about very large responses?
The limit is your browser memory, not the tool. Multi-megabyte payloads work, they just take a moment.

Ready to try it out?

Put this knowledge into practice with our free tool.

Go to Tool

Related tools