Black Friday: 50% off every paid plan with code BF50. Ends 5 December.

See prices

Free tool

JSON formatter, check it, fix it, read it.

Paste JSON or open a .json file. It is checked as you type, and a mistake is marked on its line with the exact column. Fix repairs the usual problems in JSON copied from code or an AI answer, such as comments, trailing commas, single quotes and missing commas, and lists every change it made. Browse it as a tree, search it, minify it, sort the keys, or turn it into YAML, CSV or XML. Big files open without freezing the page.

Need a custom tool, app or website? Contact us 
Input
Result

The formatted JSON shows here.

Paste on the left, open a file, or press Example to see a broken one fixed.

Comments, trailing commas, single or curly quotes, keys without quotes, missing commas between lines, True, False and None, and several objects in a row. Every change is listed, with an undo.

Options

Tree

Keys

  • Cmd Enter Format
  • Cmd Shift Enter Minify
  • Option Shift F Fix
  • Cmd S Download
  • / Search

On Windows, use Ctrl for Cmd and Alt for Option.

Your JSON is read in your browser. It is never uploaded or saved, so API keys and private data stay with you. Only your settings are remembered on this device.

The rules

What valid JSON needs.

01 / Quotes

Double quotes only

Keys and text values go in "double quotes". Single quotes and keys without quotes are JavaScript, not JSON.

02 / Commas

None at the end

A comma goes between items, never after the last one in a list or an object.

03 / Values

A short list

Text, numbers, true, false, null, lists and objects. No comments, no undefined, no NaN.

Guide

How to format and validate JSON, and fix the errors.

A JSON formatter takes JSON squashed onto one line, or laid out unevenly, and rewrites it with one value per line and even indents so you can read it. A validator checks that it follows the JSON rules and tells you where it breaks. This one does both as you type, marks the line of the first mistake in your input, repairs the common mistakes in one click with a list of what changed, and shows the result as formatted JSON, a tree, YAML or CSV.

How to use the JSON formatter

  1. Paste your JSON into Input, press Paste, drop a .json file on the Input box, or press Open file. With Check as I type ticked, the result updates as you type.
  2. Read the line under the panes. Valid JSON shows the size in and out, the number of keys and how many levels deep it goes.
  3. If there is a mistake, its line turns red in the Input, and the Result shows the line and column, the lines around it and an arrow under the spot. Press Show in the input to jump the cursor there, or Fix common mistakes.
  4. Choose an Indent of 2, 3 or 4 spaces or Tabs, and tick Sort keys A to Z if you want keys in order.
  5. Switch the Result between JSON, Tree, YAML, CSV and XML, and type in the search box to find a key or value.
  6. Pick Formatted or Minified, then press Download or Copy. Download saves a .json, .yaml or .csv file to match the view.

Your settings are remembered on this device. The JSON itself is not saved anywhere: reload the page and the box is empty.

Reading an error message

The checker reads your JSON from the start and stops at the first character that is not allowed in that spot. Take this line:

{"name": "Ada" "age": 36}

It reports line 1, column 15, "A comma is missing here, between two items". After the value "Ada" the checker needs a comma before the next key, and the arrow points just after "Ada", where the comma belongs. When the next item starts on a new line, the mistake is reported at the end of the line before, since that is where the comma goes. Here are the messages you will see most:

MessageUsual cause
A comma is missing here, between two itemsTwo values or keys with no comma between them
Extra comma before } (or ])A trailing comma after the last item
Keys need double quotesA key with no quotes, as in JavaScript
Text needs double quotes, not single quotesStrings written with 'single quotes'
Curly quotes are not allowedJSON pasted from a word processor or a chat app that changed the quotes
Comments are not allowed in JSONA //, /* */ or # comment copied from a config file
True is PythonTrue, False or None from a Python print-out
The JSON ends too earlyA missing closing bracket or brace, often from a copy that was cut short
Extra text after the end of the JSONTwo JSON documents pasted together, or JSON Lines with one object per line
Text cannot run over a line breakA string that spans two lines, or a closing quote that is missing

What Fix common mistakes repairs

JSON copied from JavaScript code, a Python print-out or an AI chat answer often looks right but breaks the rules. Fix goes through the text once, leaves everything inside strings alone, and:

  • removes //, /* */ and # comments;
  • removes trailing commas before a closing bracket or brace, and doubled commas;
  • adds a comma where one is missing between two items;
  • turns 'single-quoted' and curly quoted strings into "double-quoted" ones, and puts double quotes round keys that have none;
  • writes line breaks and tabs inside text as \n and \t;
  • turns Python's True, False and None into true, false and null, and JavaScript's undefined, NaN and Infinity into null;
  • puts several values in a row, such as JSON Lines, inside one [ ] list.

Afterwards a yellow box lists each kind of change with its line numbers, and those lines are marked yellow in the Input. Fix guesses what you meant, so read the marked lines before you use the result, especially where NaN or undefined became null. Undo the fix puts your text back exactly as it was. If something is still wrong after Fix, the first remaining mistake is shown.

Tree, search and paths

Tree shows each object with its number of keys in braces and each list with its number of items in square brackets. The first two levels open by default; click any line to open or close it. Lists and objects with more than 100 entries are split into groups of 100, so a list of a hundred thousand items stays quick to open.

Click a key in the tree and its path appears under the tree, such as $.users[0].name, with Copy path and Copy value. The path is written the JSONPath way, so you can paste it into code or a query.

The search box finds keys and values in every view. Press Enter for the next match and Shift and Enter for the one before. In the tree, the match is opened and selected for you.

YAML, CSV and XML

  • YAML writes the same data in YAML block style with two spaces. Text that could be read as a number, true, false or null, or that holds a colon or a hash, is kept in double quotes so it comes back the same.
  • CSV needs a list of objects. Each object becomes a row and each key a column. Keys inside nested objects become columns joined with dots, such as address.city, and lists inside a cell are written as JSON. If the top level is an object, the biggest list of objects inside it is used, and the note above the result says which one. The downloaded file starts with a byte order mark, so Excel reads accents and other characters correctly.
  • XML writes every object key as an element inside a root element. A list repeats its key's name for each entry, null becomes an empty element, and a key XML cannot use as a name becomes an item element with the real key in a key attribute. Text is escaped. It is a plain mapping, not a schema, so check it against what the receiving system expects.

Warnings on valid JSON

Some JSON is valid but will not come back the way it was written. The tool says so in a yellow strip above the result, with a link to each line:

  • Repeated keys. If an object has the same key twice, only the last value is kept.
  • Numbers too long to keep exactly. Whole numbers above 9,007,199,254,740,991 cannot be stored exactly in JavaScript, so a long ID such as 12345678901234567890 comes back as 12345678901234567000. Keep IDs like that in quotes.

Two smaller changes happen without a warning: number style is simplified, so 1.0 becomes 1 and 1e3 becomes 1000, and escapes are written out, so \u00e9 comes back as é.

Big files

The JSON is read in the background, so the page keeps responding while a big file is checked, and the result is drawn only a screen at a time, with colours, however long it is. A file over 3 MB is kept out of the Input box, which would be slow to edit, and Edit it here anyway puts it in if you need to change something. The limit is the memory of your browser tab; files up to 200 MB can be opened.

Keyboard shortcuts

  • Cmd and Enter formats, and adding Shift minifies.
  • Option, Shift and F runs Fix.
  • Cmd and S downloads the result.
  • / jumps to the search box, and Esc clears it.

On Windows and Linux, use Ctrl for Cmd and Alt for Option.

Tips for working with JSON

  • Compare two responses. Format both with the same indent and Sort keys ticked, then paste them into the diff checker to see which values changed.
  • Need more control over a spreadsheet? JSON to CSV has more options for picking the rows.
  • Private data stays private. The JSON is read in this browser tab and is not uploaded or saved, so API keys and customer data in a response are not sent anywhere.

Questions

Good to know.

Is it safe to paste JSON with API keys or personal data?

On this page, yes: the JSON is checked and formatted by your own browser and never leaves the tab. That is not true of every online formatter, so check before you paste secrets elsewhere.

What does "Unexpected token" mean?

It is the browser's own message when JSON breaks: the reader met a character it did not expect at that spot. This tool reads the JSON itself and names the real problem instead, such as a missing comma, a comment or single quotes, and marks the line in your input.

What does Fix change?

It removes comments and trailing commas, adds missing commas, turns single and curly quotes into double quotes, puts quotes round bare keys, and turns True, False and None into true, false and null. It also turns undefined, NaN and Infinity into null, the nearest JSON value. Every change is listed with its line, the lines are marked, and Undo the fix puts your text back.

How large a file can it handle?

Files of tens of megabytes open fine, since the JSON is read in the background and only the visible part of the result is drawn. Files over 3 MB are kept out of the Input box to keep the page quick. Up to 200 MB can be opened, if your browser tab has the memory.

What is minified JSON?

The same data with every space and line break that is not needed taken out, so it is smaller to send or store. Format turns it back into readable lines.

What is the difference between JSON and a JavaScript object?

JSON is a stricter text format. Keys and strings must use double quotes, there are no comments or trailing commas, and values are limited to text, numbers, true, false, null, lists and objects. JavaScript allows all of those extras.

Why did my long ID number change after formatting?

Whole numbers above 9,007,199,254,740,991 cannot be held exactly by a browser, so they are rounded when the JSON is read. Store long IDs as strings in quotes and they stay exact.

Can it format JSON Lines, with one object per line?

Yes, with one click. Several objects in a row show "Extra text after the end of the JSON", and Fix puts them inside one [ ] list with commas between, which is valid JSON you can format, browse and turn into CSV.

Is my JSON saved anywhere?

No. It stays in this tab and is gone when you close or reload it. Only your settings, such as the indent and the view, are remembered in this browser.

Can it turn JSON into YAML or CSV?

Yes. Switch the Result to YAML or CSV and press Download. CSV needs a list of objects; nested keys become columns joined with dots.

Does Sort keys change my data?

No. JSON objects have no meaningful key order, so sorting only changes how it reads. Lists keep their order, because order matters in a list.

Listed on

Listed on JustMacAppsMotionShine on Mac App IndexMotionShine on ScrollLaunchMotionShine featured on StartupBaseFeatured on FazierFeatured on Twelve ToolsMotionShine - Featured on Smol Launch