JSON Formatter Online

Format, validate, repair, minify and explore JSON in your browser.

JSON Formatter Online: what it does

Paste or upload your JSON and this JSON formatter will beautify it into clean, indented, readable text in one click. It doubles as a JSON validator: if the input has a syntax error you see the exact line and column, and the Repair button can fix common mistakes for you.

Everything is browser-based. Your JSON is parsed on your own device, so API responses, config files and payloads containing private data are never sent to a server. Switch between the formatted text, a collapsible tree view and a graph view, or minify the JSON when you need the smallest possible payload.

What the JSON formatter can do

  • Beautify and pretty print JSON with consistent two-space indentation
  • Validate JSON and pinpoint syntax errors by line and column
  • Minify JSON to remove whitespace for APIs, configs and URLs
  • Tree view with expand and collapse for large, deeply nested JSON
  • Graph view that draws objects and arrays as connected boxes
  • File upload for .json and .xml files, or just paste
  • Repair invalid JSON: quotes, trailing commas, comments, truncated input
  • Stringify JSON into an escaped string, and auto-detect stringified JSON
  • Also formats and explores XML payloads

How to format JSON online

  1. Paste your JSON into the input box, or choose a file with Upload file.
  2. Click Format to beautify it, or Minify to compress it.
  3. Use Tree or Graph view to explore nested objects and arrays; click a node to highlight it in the input.
  4. If a syntax error is reported, press Repair to see a before/after of the fix, then Apply to input.

Examples

Pretty print a minified API response

A one-line API response is hard to read. Load it, and the formatter beautifies it into an indented tree.

{"id":101,"name":"Ada Lovelace","roles":["admin","editor"],"active":true,"address":{"city":"London","zip":"EC1A"}}

Minify formatted JSON

Remove every unnecessary space and line break to get the smallest valid JSON.

{
  "service": "billing",
  "retries": 3,
  "endpoints": [
    "/invoices",
    "/payments"
  ]
}

Format an XML payload

The same tool also parses XML and shows it as a navigable tree.

<order id="7"><customer>Ada</customer><item sku="A1" qty="2"/><item sku="B9" qty="1"/></order>

Frequently asked questions

How do I format JSON online?

Paste your JSON into the input box and click Format. The tool beautifies it with indentation and line breaks, and shows it as text, a tree or a graph.

Is this JSON formatter and validator free and private?

Yes. It is free, and it is entirely browser-based: your JSON is parsed on your own device and is never uploaded to a server.

What is the difference between beautify, pretty print and minify?

Beautify and pretty print mean the same thing: adding indentation and line breaks so JSON is easy to read. Minify does the opposite and strips all optional whitespace to make the JSON as small as possible.

How do I find a syntax error in my JSON?

When the input is not valid JSON, the status bar shows the error message with its line and column and the faulty spot is highlighted in the input. You can also press Repair to fix common problems automatically.

Can I upload a JSON file?

Yes. Use Upload file to open a .json or .xml file from your device. The file is read locally by your browser.