JSON Formatter & Validator

Beautify, minify and validate JSON with exact error positions and a collapsible tree view.

Format or validate valid JSON to see the tree.

About this tool

JSON (JavaScript Object Notation) is the most common format for sending data between servers, browsers and mobile apps. It is easy for machines to read, but a response copied from an API or a log file is often one long unreadable line. This free JSON formatter turns that line into clean, indented text, and it checks the syntax at the same time so you know straight away whether the data is valid.

Paste your JSON into the input box and choose an action. Format rebuilds the document with the indentation you prefer (2 spaces, 4 spaces or tabs). Minify removes every unnecessary space and line break, which is useful when you want to shrink a payload or embed JSON in a configuration value. Sort keys orders object properties alphabetically, which makes two documents much easier to compare. The tree view lets you collapse and expand objects and arrays, so you can explore large responses without scrolling through thousands of lines.

If the input is not valid, the tool tells you what is wrong and, whenever the browser reports it, the line and column of the problem. The most common mistakes are trailing commas, single quotes instead of double quotes, unquoted property names, and missing brackets. Fix the highlighted position and run the tool again.

Everything runs locally in your browser with JavaScript. Your data is never uploaded to a server, which makes this page safe to use with tokens, internal API responses and other sensitive snippets.

How to use

  1. Paste your JSON into the Input box, or click Upload file to open a .json file from your computer.
  2. Pick the indentation you want: 2 spaces, 4 spaces or tab.
  3. Click Format to beautify, Minify to compress, or Validate to only check the syntax.
  4. Tick Sort keys if you want object properties ordered alphabetically.
  5. Switch to the Tree view tab to explore nested data, then use Copy or Download to save the result.

Tip: press Ctrl + Enter inside the input box to format quickly.

Frequently asked questions

A JSON formatter (also called a beautifier or pretty printer) rewrites JSON text with consistent indentation and line breaks so people can read it. It does not change the data, only the whitespace.

No. The formatter runs entirely in your browser. The text you paste never leaves your device, so it is safe to use with private data.

The usual causes are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments (which JSON does not allow), or a missing bracket or brace. The error message shows where the parser stopped.

Formatting adds whitespace to make the data easy to read. Minifying removes all optional whitespace to make the text as small as possible. Both produce JSON with identical content.

Sorting only changes the order of properties inside objects. JSON objects are unordered by definition, so the meaning stays the same. Arrays are never reordered.

There is no fixed limit, but very large files (tens of megabytes) depend on your device memory. For files that big, use the minify or validate actions instead of the tree view.

Related articles

Web hosting by Somee.com