JSON Formatter

Format, minify and validate JSON in one place. Paste your JSON, press a button and get clean, readable output or a short, compact version. If something is wrong, you see exactly where. Everything runs in your browser, so your data is not uploaded to our servers.

All Free ToolsBase64 Encode and DecodeURL Encode and DecodeUUID Generator

Your JSON is processed in your browser. It is not uploaded to our servers.

What Is a JSON Formatter?

JSON is a simple text format that apps and websites use to send data to each other. When it arrives as one long line it is hard to read. A JSON formatter, also called a JSON beautifier, adds line breaks and indentation so you can see the structure. A minifier does the opposite and removes the extra spaces to make the text as short as possible.

How to Format JSON

  1. Paste your JSON into the first box, or press Sample to try an example.
  2. Choose the indent size and, if you like, tick Sort keys A to Z.
  3. Press Format for readable output, Minify for compact output, or Validate to only check it.
  4. Press Copy result to copy the output.

How Validation Works

When you press any button, the tool first checks that your text is valid JSON. If it is, you see how many keys it has and how many levels deep it goes. If it is not, you see the error and, when possible, the line and column where the problem was found.

Common JSON Mistakes

  • A comma after the last item in an object or list. JSON does not allow trailing commas.
  • Single quotes. JSON text and keys need double quotes.
  • Keys without quotes, such as {name: “Ali”}. Keys must be in double quotes.
  • Comments. JSON does not support // or /* */ comments.
  • Values like undefined, NaN or Infinity. These are not valid in JSON. Use null or a string instead.
  • A missing comma between two items, or a missing closing bracket or brace.

Limits to Know About

  • Everything is processed in your browser, so very large files, for example above 20 MB, may be slow or freeze a small device.
  • Sorting keys changes the order of keys in objects, but never the order of items in a list.
  • Very large numbers beyond 15 or 16 digits may lose precision, because the browser reads them as normal numbers.
  • This tool works with JSON only. It does not convert JSON to other formats.

Frequently Asked Questions

Is this JSON formatter free?

Yes. It is free to use, with no sign-up.

Is my JSON uploaded anywhere?

No. It is processed in your browser and is not sent to our servers.

What is the difference between format and minify?

Format adds line breaks and indentation to make JSON easy to read. Minify removes them to make the text as short as possible.

How do I fix Unexpected token errors?

Look at the line and column shown in the message. The most common causes are a trailing comma, single quotes, or a missing comma or bracket.

Does it change my data?

No. Formatting and minifying only change the spacing. Sorting keys changes only the order of keys inside objects.

More Free Tools

Try the Base64 encoder and decoder, the URL encoder and decoder, the UUID generator or the online text editor, or browse all free online tools.