AllinHub

JSON formatter

Format, minify and check JSON, with the line and column of the first error.

Paste a document on the left to check it.

Tree

The tree appears once the document is valid.

Paste a JSON document and it is checked while you type. Format it with two spaces, four spaces or a tab, minify it to one line, or only validate it and read the report. When the document is broken, the tool names the line and the column and draws a caret under the character that stopped the parser. Sort keys puts every object in order at every depth, and the tree view folds a long document down to the part you care about. Everything runs in your browser: the document is never uploaded, and Clear removes the copy kept on this device.

How to use

  1. Paste your JSON into the box on the left.
  2. Choose format, minify or validate, and set the indent.
  3. Read the result on the right, or the line and column if the document is broken.
  4. Copy the result or download it as a .json file.

What it handles

  • A syntax error names the line and the column and puts a caret under the character that stopped the parser, so you do not have to count brackets.
  • Trailing commas, comments and single quotes are reported with their position. Nothing is repaired silently: a guess about what you meant can change the data.
  • Duplicate keys are a warning, not an error. The last value wins, as in every JSON parser, and each repeat is listed with its line and column.
  • Numbers keep their spelling: 1.0, 1e2, -0 and integers above 9007199254740991 come back exactly as written, not rounded to what a double holds.
  • Key order survives, a leading byte order mark is skipped and reported, and a key called __proto__ stays an ordinary key.
  • Ten thousand levels of nesting are parsed, written back and sorted without a stack overflow.

FAQ

How do I find the error in my JSON?

Paste the document and read the block under the result. It gives the line and the column, says what the parser expected, and shows the offending line with a caret under the exact character. Start there rather than at the top of the file: a missing comma is usually reported on the line after the one that is wrong.

Is my JSON uploaded anywhere?

No. Parsing, formatting and sorting all happen in your browser, on your device, and the page keeps working after you go offline. Nothing is logged or sent to a server. The only copy is in your browser's local storage, kept so the document is still there when you come back on this device, and Clear removes it.

Is there a size limit?

Documents up to 200 kB are processed while you type. Above that the work moves to a background thread with a progress readout, so the page never freezes; the hard cap is 10 MB. The tree view is built for documents up to 1 MB, and larger ones still format, minify and validate. The copy kept in your browser stops at 200 kB.

Does it fix trailing commas?

No, it reports them. A comma before a closing bracket is invalid JSON, so the parser stops and points at it. Removing it for you would hide the fact that whatever produced the file writes something other readers will reject. Delete the comma yourself and run the document again.

What happens to duplicate keys?

They are kept and reported as a warning with the line and column of each repeat. The standard says names should be unique but does not forbid repeats, so this is not an error. In the output the last value wins, as in most parsers. The first twenty repeats are listed and the rest are counted.

Does sorting keys change the data?

It changes the order of keys inside objects, at every depth, and nothing else. Values, arrays and the order of array elements are untouched. JSON objects are unordered by definition, so any parser reads the sorted document as the same data. It helps when you compare two configuration files that differ only in the order a tool wrote them.

Updated

All tools