Skip to main content

JSON Formatter & Validator

Paste JSON to make it readable, shrink it, or find the exact spot where it is broken.

Free, no sign-up. Everything runs in your browser.

Indent

Step by step

How to use JSON Formatter & Validator

  1. 1

    Paste your JSON

    Paste or type into the box. It is checked as you type, so you see right away whether it is valid.

  2. 2

    Choose how to show it

    Format adds line breaks and indents. Minify removes all extra space. You can pick 2 spaces, 4 spaces or tabs, and sort the keys.

  3. 3

    Copy or download

    Press Copy result or Download to save it as a .json file. If the JSON is broken, the message shows the line and column.

Overview

About JSON Formatter & Validator

JSON is the text format used by most websites, apps and APIs to send data. It is easy for computers to read but hard for people when it is squeezed onto one line. This tool lays it out with indents so you can read it, or squeezes it into the smallest size for sending.

It also checks that your JSON is valid. When something is wrong, such as a missing comma, a trailing comma or single quotes instead of double quotes, it tells you the line and column and shows the line, so you can fix it quickly.

Everything runs in your browser using its built-in JSON support. Your data is not uploaded, which is why it is safe to use with private API responses and config files.

When it helps

  • Read an API response that arrives as one long line
  • Find the missing comma or quote that breaks a config file
  • Shrink JSON before putting it in a request or a file
  • Sort the keys so two JSON files are easy to compare

Specs

Supported files and limits

Works with
Any JSON text: objects, arrays, strings, numbers, true, false and null
Actions
Format, minify, validate; sort keys; 2 spaces, 4 spaces or tabs
Largest input
2 MB (about 2 million characters)
Errors
Shows the line, column and the line of text where the problem is
Where it runs
In your browser. Nothing is uploaded.

Good to know

  • Only strict JSON is accepted. Comments, trailing commas, single quotes and unquoted keys are errors, as in most programs.
  • Whole numbers larger than 9007199254740991 can lose their last digits, because browsers read numbers as doubles. Keep big IDs as strings.
  • If a key appears twice in the same object, only the last one is kept.
  • Inputs over 2 MB are refused, because showing very long text makes the page slow.

Fix a problem

Troubleshooting

It says unexpected token or unexpected character

Look at the line and column shown. The cause is usually just before it: a missing comma, an extra comma at the end, or a missing quote.

My JSON uses single quotes

JSON requires double quotes around keys and text. Replace the single quotes with double quotes.

It fails on comments

JSON does not allow comments. Remove the // and /* */ parts.

A long number changed

Numbers above 9007199254740991 lose precision in browsers. Put such IDs inside quotes so they stay exact.

It says the input is empty

Paste some JSON into the box. Whitespace alone is not valid JSON.

FAQ

Frequently asked questions

What is a JSON formatter?

A tool that adds line breaks and indents to JSON so a person can read it. It is also called a JSON beautifier or pretty printer.

How do I validate JSON?

Paste it in. If it is valid you see a green message, and if not you see the line and column of the first error.

Is my JSON uploaded anywhere?

No. It is read and formatted in your browser, so API responses and config files stay on your device.

What does minify do?

It removes all spaces and line breaks, giving the smallest text with the same data. It is useful before sending JSON or storing it.

Why do I get an error for a trailing comma?

Strict JSON does not allow a comma after the last item. Delete it and the JSON will be valid.

Is this JSON formatter free?

Yes, free with no sign-up.