Nifty Dev Tools
  1. Home
  2. JSON Formatter
  3. JSON Validator
Format

Paste messy JSON and get it tidy, checked and ready to use, right in your browser.

Input JSON
Output

Your sparkly clean JSON will show up here.

Saved inputs

0 / 50

Saved only in this browser on this device. Saves don't sync to your other devices, and clearing your browser data deletes them. Private windows forget them when closed.

No saves yet. Press Save to keep a copy of your input here 📌

Up to 50 saves, 1 MB each

How to use the JSON Formatter

  1. Paste your JSON into the input, press Open file, or drag a .json file onto the input box. Press Example to just try it out. We check it as you type.
  2. If something's wrong, the message below the input tells you what and where. Press Show me to jump straight to it; the character is underlined in red. If it's a common mistake, press Fix it (or Fix all) and it's fixed for you: the note above the input lists every change. Keep closes it, Undo brings your original back.
  3. Press Format (or Ctrl + Enter, ⌘ + Enter on a Mac) for readable output, or Minify for the smallest size.
  4. Copy or download the result.
  5. Want to keep it for later? Press Save (Ctrl + S). Find it again under Saved, where you can rename or delete it. While you work on a save, Save asks whether to update it or save a new copy, and New (in the bar at the top, next to Save) begins an empty one (it asks first if you have unsaved changes).

Example

Minified input:

{"id":7,"tags":["api","json"],"active":true}

Formatted with 2 spaces:

{
  "id": 7,
  "tags": [
    "api",
    "json"
  ],
  "active": true
}

Fix common mistakes in one click

JSON copied from a JavaScript file, a config file with comments, Python output or a chat answer often isn't quite JSON. Fix it repairs the usual mistakes and changes nothing else: your layout, numbers and escapes stay exactly as you wrote them. For example, this input:

{
  // from a JavaScript file
  name: 'Ada',
  tags: ['math', 'code',],
  active: True
}

Try it with this example: it opens in the tool above, and Fix all 9 shows up under it. It becomes this, and the note lists the 9 changes (a comment, 3 property names, 3 single-quoted strings, a trailing comma and True):

{
  "name": "Ada",
  "tags": ["math", "code"],
  "active": true
}

It fixes comments, trailing commas, single and curly quotes, property names without quotes, missing commas, True, False and None, NaN, Infinity and undefined (they become null), backslashes that aren't valid escapes, tabs and line breaks inside strings, no-break or invisible spaces, missing } or ] at the end, and a ``` code fence around the JSON. If something else is wrong, like a missing colon or a value that was cut off, Fix it doesn't guess: the message shows you where, and you decide.

Common JSON errors

Fix it repairs every one of these for you.

ProblemWrongRight
Trailing comma[1, 2,][1, 2]
Single quotes{'a': 1}{"a": 1}
Unquoted keys{a: 1}{"a": 1}
Comments{"a": 1 // note}Remove the comment
Special numbersNaN, InfinityUse null or a string

Got an error message from your code? Our JSON error guides explain one message each: what Chrome, Firefox and Safari say, what usually causes it and how to fix it.

FAQ

Is my JSON uploaded anywhere?

No. Everything happens in your browser, including opening files: a file you open or drop is read right here, and we never upload, log or store your JSON. See the privacy page for details.

Where are my saves and my last input kept?

Only in this browser on this device. We never upload them, and they don't sync to your other devices. Clearing your browser data deletes them, and private windows forget them when closed. Turn off Remember input if you're on a shared computer.

What's the difference between Format and Minify?

Format adds line breaks and indentation so people can read it. Minify removes all optional whitespace so it's as small as possible for machines.

Can it fix invalid JSON automatically?

Yes, the common mistakes: press Fix it below the error message. Every change is listed, nothing else is touched, Keep accepts it and Undo brings your original back. It only offers a fix when it's sure what you meant; otherwise it shows you where the problem is. Try it with an example.

Does formatting change my data?

No. Only whitespace changes. Keys stay in the same order, and values are copied exactly as you wrote them: big numbers like 12345678901234567890, spellings like 1.0 or 1e2, and escapes like é are all kept.

How big can my JSON be?

Files up to 20 MB open fine; inputs over 1 MB are processed in the background so the page stays responsive. Inputs over 1 MB aren't remembered or saved, but you can always download the result.