DevToolbox

JSON Formatter & Validator

Pretty-print, minify, sort and validate JSON with clear, line-numbered error messages.

Loading tool…

Paste raw or minified JSON and get readable, consistently indented output in one click. The formatter parses your input with a strict JSON reader, so if something is off — a trailing comma, a missing quote, an unclosed bracket — you get the line and column of the problem instead of a blank screen.

Switch to the Tree view to explore the document interactively: collapse and expand any object or array, search across every key and value at once (matches are highlighted and their branches auto-expand), and copy the accessor path to any node. Everything happens locally in your browser — your payloads are never uploaded, which makes this safe for API responses, config files and other data you would not paste into a random website.

Features

  • Beautify with 2-space, 4-space or tab indentation
  • Minify to a single line for storing in env vars or query strings
  • Interactive tree view — collapse/expand nodes, expand-all / collapse-all
  • Search keys and values; matching branches expand automatically
  • Copy the accessor path (e.g. roles[2].name) to any node
  • Optionally sort object keys alphabetically for stable diffs
  • Precise syntax errors with line and column numbers

How to use the json formatter

  1. Paste your JSON into the input panel on the left.
  2. In Text view, pick an indentation style and click Format or Minify.
  3. Switch to Tree view to collapse, expand and search the structure.
  4. Copy the formatted text, or a node's path from the tree.

Frequently asked questions

How does the tree search work?

Type in the search box above the tree. Every key and value is matched case-insensitively; matches are highlighted and the path down to each one expands automatically, with a running match count.

Is my JSON uploaded anywhere?

No. Parsing, formatting and the tree view all run in JavaScript on your device. Nothing is sent over the network.

Why does it reject trailing commas and comments?

The validator follows the official JSON specification (RFC 8259), which does not allow comments or trailing commas. Remove them, or use a JSON5/JSONC-aware editor if you need those features.

Can it handle large files?

Files up to a few megabytes format quickly. Extremely large inputs may be slow because the whole document is parsed into memory at once.

What does "sort keys" do?

It recursively reorders the keys of every object alphabetically. This is handy when you want to compare two JSON documents that only differ by key order.

Last updated September 10, 2026.

Related tools