All tools / JSON Formatter & Viewer

JSON Formatter & Viewer

Paste or open JSON to format it with clean indentation, minify it, check it for errors with the exact line and column, and explore it in a collapsible tree view. Runs in your browser.

Paste JSON above, or open a .json file.

How to use the JSON formatter

Paste your JSON into the box, or click Open file to load a .json file from your device. The tool checks it as you type. If it is valid, press Format to make it readable or Minify to make it compact, then copy or download the result. Switch to Tree to explore nested objects and arrays by expanding only the parts you need.

Example: the minified text {"user":{"name":"Ana","roles":["admin","editor"]},"active":true} becomes an indented block with user, its name and roles, and active each on its own line. In the tree view, roles shows as an array with 2 items that you can open.

Fixing common JSON errors

  • Trailing comma: [1, 2, 3,] is not allowed. Remove the comma after the last item.
  • Single quotes: JSON strings and keys must use double quotes: "name", not 'name'.
  • Unquoted keys: {name: "Ana"} is JavaScript, not JSON. Write {"name": "Ana"}.
  • Comments: // notes and /* notes */ are not part of JSON. Remove them before validating.
  • Special values: undefined, NaN and Infinity are not valid. Use null or a number instead.

Frequently asked questions

Is my JSON sent to a server?

No. Formatting, validation and the tree view all run in your browser. Nothing you paste or open is uploaded, so it is safe to use with API responses, config files and other private data.

Why does it say my JSON is invalid?

Common causes are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments, and missing commas between items. The error message shows the line and column, and the cursor jumps to that spot in the input.

What is the difference between Format and Minify?

Format (beautify) adds line breaks and indentation so the JSON is easy to read. Minify removes all unnecessary spaces and line breaks to make the file as small as possible, which is useful before sending it in an API request or storing it.

Can it open large JSON files?

Yes. Files of several megabytes work fine. The tree view only builds the parts you open, and very long arrays show the first 500 items with a "show more" button so the page stays fast. Syntax colours are turned off above 1 MB to keep things smooth.

What does "Sort keys" do?

It arranges the property names of every object in alphabetical order. This makes it easier to compare two JSON files or find a key in a big object. Array order is never changed.