JSON Editor

Edit JSON in place: format, minify or sort keys while a live status line checks it.

Valid JSON.

Everything is processed in your browser. Nothing you paste is uploaded or stored.

In-depth guide

Editing JSON safely: the live-reformat workflow and its limits

What the JSON editor page actually is (an input box with a live, read-only 2-space re-indented copy), how to use it to repair and tidy documents, and what it cannot do.

Last verified: Plain-text version of this guide

Key figures at a glance

Layout
Editable input on the left, read-only output on the right
You type in the left box only; the right box cannot be edited.
Output indentation
2 spaces, fixed
Choose 4 spaces or tabs on the JSON formatter page instead.
Update timing
On every change to the input
Invalid JSON clears the output until the text parses again.
Array layout
One item per line
Short arrays are not kept on a single line.

Repair and tidy a JSON document

The page reparses on every change, so the right-hand box doubles as a validity light.

  1. Step 1: Paste the document

    Put it in the left box, or press Load example to start from the sample.

  2. Step 2: Edit in place

    While the text is valid JSON, the right box shows the re-indented version.

  3. Step 3: Fix the error if the output goes blank

    A red message gives the browser's explanation, with line and column when available. The last good output is not kept.

  4. Step 4: Copy the clean result

    Press Copy result once the right box is filled again, then paste it where you need it.

What this page is

Despite the name, this is not a syntax-highlighting code editor. It is a paired view: the left box is a plain text area where you paste or type, and the right box is a read-only copy that is re-parsed and re-indented with two spaces after every change. It exists so that you can see immediately whether your edit left the document valid, and copy a clean version when it did. Buttons: Copy result, Load example and Clear. There is no download button, no tree, no undo history beyond the browser's own, and no option for other indentation.

Everything runs locally with JSON.parse and JSON.stringify.

The live-reformat workflow

The step timeline above shows the loop. The key behaviour to remember: when the text stops being valid JSON, the right box goes blank rather than keeping the last good output, so fix the reported position in the left box and the output returns by itself. Load example replaces whatever is in the left box, so copy your text first if you want it back.

Worked example

Input with irregular spacing, a tab and a trailing zero:

{"id":7,  "name":"Mei",
	"tags":[ "a","b" ],"addr":{"city":"Singapore","zip":"018956"},"score":4.50,"note":null}

Output, captured from the real page:

{
  "id": 7,
  "name": "Mei",
  "tags": [
    "a",
    "b"
  ],
  "addr": {
    "city": "Singapore",
    "zip": "018956"
  },
  "score": 4.5,
  "note": null
}

Deleting the final } from the input blanks the output and reports Expected ',' or '}' after property value in JSON at position 111 (line 2 column 88). The "zip" string keeps its leading zero because it is a string; had it been written 018956 without quotes it would be invalid (leading zeros are not allowed in JSON numbers).

What the output changes

The output is a re-serialisation, not your text with spaces fixed. Expect: 4.50 to become 4.5; escapes such as é to become é; duplicate keys to collapse to the last value; integer-like keys to move to the front of an object; and very large integers to lose precision (12345678901234567890 becomes 12345678901234567000). Comments and trailing commas make the document invalid, so they are never preserved. Short arrays are always expanded to one item per line, so the output is longer than hand-formatted JSON that keeps [1, 2, 3] on a line.

Tip: Treat the left box as your working copy and the right box as a validity check. If the left text is already valid but badly indented, copying from the right box is faster than re-indenting by hand.

Limits

  • No search and replace, line numbers, folding or syntax colouring; use your own editor for large refactors.
  • No schema validation. A document can be valid JSON and still be wrong for your API.
  • No sorting of keys. If you need stable key order for diffs, sort keys in a script, then compare with text diff.
  • Browser memory is the only size limit, and every keystroke re-parses the whole document, so very large inputs will feel slow.

Common mistakes

  • Editing the right box. It is read-only; changes go in the left box.
  • Expecting the last valid output to stay visible while fixing an error. It disappears until the text parses.
  • Pasting a JavaScript object or JSON with comments and expecting it to be cleaned; fix the syntax first.
  • Forgetting that numbers and key order in the output can differ from the input.

Pick 4 spaces or tabs and download the result with the JSON formatter, check syntax only with the JSON validator, explore with the JSON viewer, or compress with the JSON minifier.

Frequently asked questions

What can the JSON editor do that the formatter cannot?

It rewrites the text you are editing in place: the Format, Minify and Sort keys buttons change the document itself, and a status line shows whether it is still valid.

Is my JSON sent to a server?

No. Everything happens in your browser. Nothing you paste is uploaded, logged or stored, which matters when the document contains keys, tokens or personal data.

Why is my JSON reported as invalid?

The most common causes are trailing commas, single quotes instead of double quotes around keys and strings, and unescaped line breaks inside a string. The error message gives the line and column of the first problem.

Does it change my data?

No. The document is parsed and re-serialised, so only whitespace changes. Key order is preserved and values are untouched.

Can it handle large documents?

Yes, within your browser's memory. Documents of a few megabytes are fine; extremely large files may make the page pause briefly while it parses.

Sources

  1. IETF — RFC 8259, The JSON Data Interchange Format — What counts as valid JSON text.
  2. MDN — JSON.stringify() — How the output is written back, including the indent argument.

This guide explains published rules in plain language. It is not financial, legal or official advice — rules change, so confirm with the agency linked above before you commit.

Related tools