Skip to the tool

JSON Formatter & Validator

Paste JSON to format, validate and auto-fix it in one click. Free, and it never leaves your browser.

Options
Trailing commas, single quotes, unquoted keys, comments, Python True/None Turns string values that contain JSON into real objects
Input
More
Paste JSON and press Format or Ctrl + Enter.

Your JSON never leaves your browser. Nothing is uploaded or stored on our server.

Keyboard shortcuts
  • Ctrl/⌘ + Enter format · add Shift to minify (works anywhere in the tool)
  • Ctrl/⌘ + O open a JSON file (or drag one onto the input box)
  • Tab / Shift + Tab move between buttons, boxes and panels
  • In Code or Tree view: ↑ ↓ move line by line, Home / End jump to first or last, Page Up / Page Down jump 20 lines
  • → open a section (or step inside it), ← close it (or jump to its parent)
  • Enter or Space copy the path of the current line · C copy its value
  • Ctrl/⌘ + F search keys and values · Enter next match, Shift + Enter previous, Esc clear
  • ← → on the Code / Tree tabs switch views · Esc jump back to the input box

What is a JSON formatter?

JSON (JavaScript Object Notation) is the text format most APIs, config files and apps use to exchange data. When it comes back from a server it is usually squeezed onto one long line, which makes it hard to read or debug.

A JSON formatter adds line breaks and indentation so you can see the structure at a glance. A validator checks that the JSON is correct and points to the exact line and column when it isn't. This tool does both, and it can also fix common mistakes for you.

How to use the JSON formatter

  1. Paste your JSON into the Input box, click Open file, or drag a .json file onto it.
  2. Click Format (or press Ctrl + Enter). Pasting into an empty box formats automatically.
  3. If the JSON was broken, the yellow box tells you what was fixed. Click Replace input with fixed JSON to keep the repaired version.
  4. Explore the result: fold sections with the arrows, switch to the Tree tab, or search with Ctrl + F.
  5. Click any line to copy its path, then use Copy, Download or Share link to take the result with you.

Features

  • Auto-fix broken JSONTrailing and missing commas, single quotes, unquoted keys, comments, Python True/None and cut-off brackets, with a list of every change.
  • Unwrap escaped JSONPaste {\"id\":1} or stringified JSON from logs and it is unescaped automatically.
  • Code and Tree viewsLine numbers, fold arrows and syntax colors, or a collapsible tree with item counts.
  • Copy pathsClick any value to copy its path, like data.users[3].email, or copy the value itself.
  • SearchFind keys and values with a match counter. Folded sections open automatically.
  • Share by linkThe JSON lives inside the link, so nothing is stored on a server.
  • Big filesHandles files of around 20 MB in the background without freezing the page.
  • Private by designEverything runs in your browser. Files and pasted text are never uploaded.
  • Keyboard and dark modeEvery action works from the keyboard, with light, dark and automatic themes.

Example: fixing broken JSON

This is valid JavaScript but not valid JSON:

{
  name: 'Alex',        // unquoted key, single quotes
  active: True,         // Python-style boolean
  tags: ['js', 'ts',],  // trailing comma
}

Auto-fix turns it into valid JSON and lists every change it made:

{
  "name": "Alex",
  "active": true,
  "tags": ["js", "ts"]
}

Common JSON errors and how to fix them

These are the messages browsers, Node.js and Python show when JSON is invalid. Paste the JSON above and the formatter points to the exact line and column, and fixes most of them for you.

Error messageWhat it usually meansHow to fix it
Unexpected end of JSON inputThe JSON is cut off, or the response was empty.Check that the whole response arrived. Add the missing } or ].
Expected double-quoted property name / Expecting property name enclosed in double quotesA key has no quotes, single quotes, or there is a trailing comma before }.Wrap every key in double quotes and remove the last comma.
Unexpected token '<', "<!DOCTYPE "... is not valid JSONThe server sent an HTML page (often an error or login page) instead of JSON.Open the URL in your browser and check the status code and the real response.
"undefined" is not valid JSONJSON.parse was given undefined, usually a missing value in localStorage or a variable.Check the value exists before parsing it.
Bad control character in string literalA string contains a raw line break or tab.Write line breaks as \n and tabs as \t inside strings.
Unexpected token 'T' / 'N'Python values like True, False or None.Use true, false and null.

Frequently asked questions

Is my JSON uploaded anywhere?
No. Formatting, fixing, searching and opening files all happen inside your browser. Nothing you paste or open is sent to our server. Share links carry the JSON inside the link itself, so we never store it either.
Why does it say my JSON is invalid?
The most common causes are trailing commas, single quotes instead of double quotes, keys without quotes, comments, and values like undefined or True. The error message shows the exact line and column. With Auto-fix on, most of these are repaired automatically.
What is the difference between Format and Minify?
Format adds line breaks and indentation so JSON is easy to read. Minify removes all extra spaces and line breaks so the JSON is as small as possible, which is useful before sending it in a request or saving it.
How do I get the path to a value?
Click the line in the Code view (or the row in the Tree view). The path, such as orders[0].customer.email, appears under the output and is copied to your clipboard. Keys with spaces or dashes use bracket style, like user["first name"].
How big a file can it handle?
Files of around 20 MB format in a second or two, and inputs over 1 MB are processed in the background so the page stays usable. Files up to 100 MB can be opened.
Can I share formatted JSON with a teammate?
Yes. Click Share link and send the link. It opens this page with the same JSON already formatted. Anyone with the link can see the JSON, so do not share passwords or API keys this way. Very large JSON is better shared as a downloaded file.

Related tools

JSON Formatter changelog · All tools