← Back to Tools

{ } JSON Formatter

Format, minify, and validate JSON — with an interactive tree view, syntax highlighting, and JSONPath queries.

Input JSON
Output

        
JSONPath Query

Quick Answer

JSON formatting adds indentation and line breaks to JSON data so it's easier for people to read and inspect. This tool validates, formats, and minifies JSON entirely in your browser, with an interactive collapsible tree view, syntax highlighting, and a JSONPath query evaluator for pulling specific values out of nested structures.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, text-based data format used almost universally for APIs, configuration files, and data exchange between systems. It's built from a small set of structures — objects ({}), arrays ([]), strings, numbers, booleans, and null.

How to use this tool

  1. Paste your JSON into the input box — it auto-formats as you type.
  2. Click Format for pretty-printed, indented output, or Minify to strip all whitespace. Check Sort keys to alphabetize object keys.
  3. Switch between Text, Highlighted, and Tree views of the output using the tabs.
  4. Use the JSONPath box to query specific values, e.g. $.users[0].email or $..id for every "id" field at any depth.

JSONPath syntax supported

SyntaxMeaning
$The root value
.keyAccess an object property
['key']Access a property (bracket notation)
[0]Access an array index
[*]All elements of an array or all values of an object
..keyRecursive descent — find "key" at any depth

This covers the common cases; it doesn't implement the full JSONPath specification (e.g. filter expressions like [?(@.price<10)] aren't supported).

Privacy

Parsing, formatting, tree rendering, and JSONPath evaluation all happen locally in your browser. Nothing is uploaded or stored.

FAQ

Why does it say my JSON is invalid?

Common causes: trailing commas, single quotes instead of double quotes, unquoted keys, or a missing closing bracket. The error message includes the position where parsing failed.

What's the difference between formatting and minifying?

Formatting adds indentation for readability; minifying removes all unnecessary whitespace to reduce file size — useful before sending JSON over a network.

What do the stats mean?

Keys counts every object property across the whole structure; depth is the deepest level of nesting; size compares the input and formatted output byte size.

Related Tools