JSON formatter that cites the RFC section for each rewrite
A JSON formatter indents and checks a document in this tab, so nothing you paste is uploaded. When a rewrite is lossy, the page cites the RFC section that allowed it. When a document does not parse, it names the line and the column and points a caret at the character. Format, minify, and sort keys are modes.
When a document does not parse, this page names the line and the column, prints that line back, and points a caret at the character.
Paste JSON
top-level keys only
RFC 7159 and ECMA-404 accept the same grammar as RFC 8259 for this page.
.json and .txt only, 5 MB cap. A valid file replaces the box.
Result
Spec validated against: -
Need another step? Send this to the tool chain and decode, format or hash it in one place.
- Valid JSON
- ·
- In / out
- ·
- Lossy rewrite
- ·
- Parse
- ·
- Requests
- · from Resource Timing
- Script
- · KB of a 100 KB budget
Check the offline claim yourself, in thirty seconds
Paste your JSON in - the result appears as you type. The request list stays empty. Now, with the page still open, turn off your wifi and TYPE A DIFFERENT DOCUMENT: it still works.
That test works on any tool, not just this one, and it is the only reliable way to answer the question. A privacy policy describes an intention. A network tab shows you what happened. We wrote the longer version of that argument in is it safe to paste JSON into an online formatter, including what to do when the answer turns out to be no.
On our side the claim is enforced rather than remembered. Every release runs an automated test that loads this page, types a distinctive string into the box, clicks every button, and fails the build if that string turns up in any request. It is described in how we build tools. Loading the page itself does need a connection.
The error message is the feature
Formatting valid JSON is arithmetic and every tool does it identically. The place these tools differ is what happens when the JSON is broken, which is most of the time, because valid JSON did not need a formatter.
When a document does not parse, this page names the line and the column, prints that line back, and points a caret at the character. Jump to error moves the caret in the paste box to that reported location.
One caveat worth knowing: the parser reports where it noticed the problem, which is not always where the problem is. A missing closing brace is usually noticed at the end of the document. If the marked line looks fine, the mistake is normally a little above it.
Sorting keys, and why it is here
Sort keys rewrites the document with the top-level object's keys in alphabetical order. Nested objects are left as they were. The control says top-level keys only for that reason. Paired with the diff checker it still helps when two payloads differ only in the order of top-level fields.
What this deliberately does not do
No load from a URL, no conversion to XML, CSV or YAML, no JSON Schema validation, no editing inside the tree, and no auto-repair. A repair that guesses at missing quotes or trailing commas can change the document while appearing to fix it. When something is invalid here, you get told where, and the correction stays yours.
Questions
Is there a keyboard shortcut?
Control+Enter on Windows and Linux, or Command+Enter on a Mac, re-runs the selected mode when focus is inside the tool. Space is left alone so it still scrolls the page.
Is my JSON really not being uploaded?
Not by us, and you do not have to trust that. Open a network tab and use the tool: nothing is requested. Once the page has loaded, you can turn off your wifi and type a different document: it still works. Every release is also checked by an automated test that fails the build if this page sends anything at all, which is described on how we build tools.
How big a document can it handle?
Files opened through Open a file are capped at 5 MB and must be
.json or .txt. Paste is limited by your device rather
than a server quota. There is no upload size limit on paste because there is no
upload.
Why does it say my JSON is invalid when it looks fine?
The three usual causes are a trailing comma before a closing bracket, single quotes instead of double quotes, and a comment. All three are legal in JavaScript and none of them is legal in JSON. The line and column marker will be on or just after the offending character.
Why does it sometimes say the output is not my input?
Because occasionally it is not, and the alternative is letting you copy something
you did not paste. JSON numbers are read into IEEE 754 doubles, and some numbers
do not survive that trip. A key repeated inside one object keeps the last value.
The lossy list names the key, the before and after values, and the RFC 8259 clause.
Spelling-only number forms stay off the list on purpose: 1.0,
1E2, and trailing zeros such as 1.50 are ordinary JSON,
the value is unchanged, and flagging them would fire on a large fraction of valid
documents. Negative zero is not spelling. IEEE 754 treats -0 and
0 as different values, so that rewrite is listed and cites RFC 8259 §6.
Why is Jump to error sometimes disabled?
It only moves the caret when the parser reports a line and column. Valid JSON has nowhere to jump, and an empty box is not an error.
Does the share link send my JSON anywhere?
No. The share link carries the document in the part of the URL after the
#, and browsers never transmit that part in a request. The recipient's
browser reads it locally when the page loads.
Is my JSON saved between visits?
No. Nothing is written to your device and refreshing loses the contents of the box. If you want to keep something, copy the share link.
Will it beat the formatter I already use?
On formatting, no, and it would be silly to claim otherwise: indenting JSON is a solved problem. If your current one is a browser extension or something built into your editor, keep using it.
Related tools
If you are deciding whether to paste JSON into this tab at all, is it safe to paste JSON into an online formatter is the check. Got two versions of a payload? The diff checker can sort keys on both sides first, so a reordered response stops reading as a rewrite. Pasting the middle segment of a JWT? That is base64, specifically the URL-safe alphabet. And when you need several of these in a row, the tool chain runs them in sequence on one paste.