Skip to content

JSON formatter & validator. Errors down to the column.

Files never leave your browser. Nothing is uploaded.

Result Waiting for input…

              
            

Strict JSON, parsed on your device

Paste JSON or drop a .json file (up to 15 MB): the parser checks it against strict-JSON rules, pretty-prints with your choice of 2-space, 4-space or tab indent, and can sort keys alphabetically. Parse errors show the exact line and column with a caret under the broken character. One click minifies, escapes a document for embedding inside another JSON string, or unescapes a quoted string back to raw text, and a foldable tree view shows per-node key and item counts. Everything runs locally, so it even keeps working offline.

§ · written guide

How to use the JSON Formatter

This formatter checks JSON against the strict standard, then pretty prints it, minifies it, sorts its keys or shows it as a foldable tree. It uses your browser's own JSON parser, and when the parse fails it points to the exact line and column of the problem. It is for developers and anyone reading API responses, config files or exported data.

Step by step

  1. Paste or load your JSON

    Paste into the Input JSON box, or drop a file on the Load .json button (or click it to browse). Files up to 15 MB are accepted. Press Load sample to try it with a small example. The Tab key inserts two spaces inside the box instead of leaving it.

  2. Watch the status pill

    As you type, the pill above the Result pane checks the text. It shows Valid with a count, or Error with the line and column, without changing what you typed.

  3. Format it

    Press Beautify for indented output, Minify for a single line, or Validate to check it and show the indented version. Choose 2 spaces, 4 spaces or Tab from the indent menu, and tick Sort keys to order every object's keys alphabetically.

  4. Fix any error

    If the JSON is invalid, the Result pane shows the browser's message, the line and column, and the lines around it with a caret under the character where parsing stopped.

  5. Explore the structure

    Press Tree view to see the data as a tree. Click any object or array row to fold or unfold it. Press Tree view again to return to the text output.

  6. Take the result with you

    Press Copy to copy the result, or Download .json to save it as formatted.json. Clear empties both panes.

Reading the result

  • For an object, the count in the status pill is the total number of keys at every level, followed by the size of your input. Load sample reads 21 keys · 404 B. For an array, it is the number of top level items.
  • In the text output, keys, strings, numbers and punctuation are colored differently so the structure is easy to scan.
  • An error such as {"a":1,} with a trailing comma reports line 1, column 8: the parser expected another key after the comma and found the closing brace instead.
  • In Tree view, every object shows how many keys it has and every array how many items, before you unfold it.

Tips and common mistakes

  • Download .json always saves the indented version, even after Minify. To keep the minified text, use Copy.
  • Comments, trailing commas, single quotes and unquoted keys are not valid JSON. They are the most common reasons a config file fails here.
  • Escape turns the whole input into one quoted JSON string so it can sit inside another JSON value. Unescape does the reverse and only works when the input is a single quoted string.
  • Sort keys never reorders arrays, because array order carries meaning. Sorting two API responses before you compare them removes differences that are only key order.
  • If an object repeats a key, only the last value survives formatting. Very large whole numbers, such as 64 bit IDs, can lose their last digits because the browser stores every number as a standard double.

Privacy and limits

Parsing and formatting happen in your browser. Nothing you paste or load is uploaded or saved, so it is safe for JSON that holds keys or customer data. The file loader stops at 15 MB; pasted text has no fixed limit, but the input box slows down with very large documents.

Back to the tool

§ 02 · what you can do

One toolbar, every JSON chore.

BeautifyPretty-print with 2-space, 4-space or tab indent, pick the convention your codebase uses.
MinifyCollapse a document to a single line for compact payloads and API requests.
Validate with positionsParse errors show the exact line and column, with a caret pointing at the broken character.
Sort keysRecursively order object keys alphabetically to make two responses diff-friendly.
Escape & unescapeStringify a document for embedding inside another JSON string, or reverse it.
Tree viewFold and unfold the structure, with key and item counts shown on every node.
§ 04 · faq

Frequently asked questions.

Is the JSON I paste sent anywhere?
No. The page uses the browser's native JSON.parse and JSON.stringify, and both run entirely on your device. Safe for JSON containing API keys, customer records or internal config, nothing is uploaded, and there is no sign-up.
What does “Sort keys” do?
It recursively re-orders every object's keys alphabetically (case-insensitive). Sort two API responses and their diff collapses to genuine differences instead of key-order noise. Arrays are never re-ordered, order is meaningful there, only object keys move.
What's the difference between Escape and Unescape?
Escape converts JSON-special characters (quotes, backslashes, newlines, tabs) into their backslash-escaped form so the result can sit inside a JSON string value, useful for embedding one JSON document inside another. Unescape reverses it: a JSON-quoted string becomes the original raw text. Both work on the whole textarea content.
How do you find parse errors?
When JSON.parse throws, the browser reports a character position (Chrome, Edge), a line and column (Firefox), or only a quoted fragment of the broken source. We normalize all three forms, compute the line and column, and render a numbered snippet with a caret under the exact character. Typical culprits: trailing commas, single quotes, unquoted keys, embedded comments.
Why no JSON5 / JSONC support?
JSON5 (comments, trailing commas, unquoted keys) and JSONC (the tsconfig.json variant) follow different parse rules. This tool targets strict JSON per RFC 8259 because that is what every API accepts. Paste JSON5 and the error message will point at the construct, usually a comment or trailing comma, that needs removing.
What's the maximum size?
Pasted input is limited only by your browser's memory; the file loader caps at 15 MB. Modern browsers handle 10-50 MB documents in a few hundred milliseconds, though the textarea gets sluggish well before that. For 100 MB+ files, use jq or a streaming parser at the command line.

Published · Last updated .

Priya sent you a message Online now

Talk to a Developer Now

Share your name and email to reply.

Reply