Toolminex
Developer Tools

JSON Formatter

Format, validate, beautify, and minify your JSON instantly. Fast, private, and processed entirely in your browser.

Loading...

How to format and validate JSON

Paste, upload or import JSON, format it, and read it as a tree or copy the indented text.

  1. 01

    Get your JSON in

    Paste it, upload a .json file, or use Import URL to fetch it straight from an address. Sample loads an example to try the features.

  2. 02

    Press Format JSON, or Minify

    Format re-indents valid JSON with 2 spaces and shows it as a collapsible tree. Minify strips every space and line break for the smallest output. Invalid JSON shows your browser's error message, which in Chrome and Edge includes the line and column.

  3. 03

    Explore, copy or download

    Expand and Collapse open or close the whole tree. The stats bar shows lines, bytes and keys. Copy or Download gives you the formatted or minified text.

  4. 04

    Keep several documents open in tabs

    New adds a tab, and tabs can be renamed. They're saved in your browser, so they're still there when you come back.

The errors that break JSON most often

JSON is stricter than JavaScript. Code that runs fine as a JavaScript object can fail as JSON. These are the usual reasons a paste won't format:

ExampleProblemFix
{"a": 1,}Trailing comma after the last itemDelete the final comma
{'a': 'x'}Single quotesUse double quotes for keys and strings
{a: 1}Unquoted keyQuote every key: {"a": 1}
{"a": “x”}Curly quotes pasted from a documentReplace with straight " quotes
// commentComments aren't allowed in JSONRemove them, or use JSONC-aware tools
{"a": NaN} or undefinedNot valid JSON valuesUse null or a number

Error wording varies by browser. Chrome reports something like "Expected double-quoted property name in JSON at position 7 (line 1 column 8)", while Safari's message is shorter and has no position. If you can't spot the problem, try another browser for a more precise pointer.

What formatting does to your data

Formatting parses the text into JavaScript values with JSON.parse, then writes it back out with JSON.stringify at 2-space indentation. Usually that's lossless, but three things can change. Numbers are normalised, so 1.10 comes back as 1.1 and 1e3 as 1000. If a key appears twice in the same object, only the last value survives.

The one that bites is large integers. JavaScript numbers are exact only up to 9,007,199,254,740,991 (2^53 − 1). A 64-bit ID such as 9007199254740993 is read as 9007199254740992, and the formatted output silently shows the wrong number. If your JSON holds IDs from systems like Twitter or a database with 64-bit keys, keep those IDs as strings, or don't rely on a browser-based formatter to preserve them.

When a formatter helps

Reading an API response

Paste the one-line response from your browser's Network tab, format it, and collapse the parts you don't need.

Checking a config file before deploying

A missing comma in package.json or a settings file stops an app from starting. Format it here first to catch the error with its position.

Comparing a couple of payloads

Open each in its own tab to switch between them. For a line-by-line comparison, use JSON Compare.

Limits worth knowing

  • Indentation is fixed at 2 spaces. If your project uses 4 spaces or tabs, re-indent in your editor afterwards.
  • Keys aren't sorted, and comments, trailing commas or JSON5 syntax aren't accepted.
  • Import URL fetches from your browser, so it only works for addresses that allow cross-origin requests. Many APIs don't; download the file and upload it instead.
  • Very large files, tens of megabytes, can make the tree view slow. The text output stays usable.

Frequently asked questions

No. Parsing and formatting happen in your browser. Import URL is fetched by your browser too, directly from the address you give it.
In your browser's local storage on this device. Clearing site data removes them, so download anything you want to keep.
No. It checks that the JSON is well formed, not that it matches a particular structure.
Integers above 9,007,199,254,740,991 can't be stored exactly in JavaScript and get rounded. Store such IDs as strings.
No. The tree is for reading. Edit the text in the input panel and format again.
No. Keys stay in the order they appear in your input; only whitespace and indentation change.

Related developer tools

Something not working right?