Skip to content
HandfulTools

JSON Formatter

Turn minified or messy JSON from an API response, log or config file into readable, indented JSON. Invalid JSON is reported with the exact line and column of the problem.

Runs in your browser

Loading…

How to use

  1. Paste your JSON.
  2. Choose 2 spaces, 4 spaces or tabs.
  3. Optionally sort object keys alphabetically.
  4. Copy the formatted JSON.

How it works

The input is parsed with the browser's native JSON parser, which strictly follows RFC 8259, then re-serialised with your chosen indentation. Because the data is really parsed, the output is guaranteed to be valid JSON and numbers, strings and escapes are preserved exactly.

Sorting keys is recursive and makes two JSON documents easy to compare with the Text Compare tool.

Examples

API response
{"id":7,"tags":["a","b"]} becomes a nicely indented, multi-line object.
Comparing two API responses
Sort the keys of both payloads, then paste them into Text Compare — the real differences stand out instead of key-order noise.

Common uses

  • Reading API responses and webhooks
  • Cleaning up configuration files
  • Preparing JSON for documentation and code review

Privacy & security

This tool runs entirely in your browser. Your files and text are never uploaded to our servers — processing happens on your device and results are created locally. How each tool handles files

Frequently asked questions

Does it accept comments or trailing commas?

No. Standard JSON doesn't allow them, and the formatter reports them as errors so you know the file would fail in other parsers.

Is my JSON sent to a server?

No. Parsing and formatting happen in your browser, so it's safe for private data.

Is there a size limit?

Only your device's memory. Files of several megabytes format in well under a second.

Where exactly is my syntax error?

The error message gives the line and column of the first problem. The usual culprits are a trailing comma before } or ], single quotes instead of double quotes, and an unescaped quote or backslash inside a string.

How do I minify instead of indent?

Choose the minify option: the same parsed data is written without spaces or line breaks, which is what you want before putting JSON in a config value, an environment variable or a URL.

Last updated: