Quick access

Saved in this browser. Sign in to keep it on all your devices.

JSON Formatter & Validator

Format, validate, repair, explore, and convert JSON as you type. Everything runs in your browser.

Private — data never leaves your device
Input Valid Invalid

Drop your JSON file


Paste JSON on the left — it formats as you type.

The tree appears once your JSON is valid.

Click a key to copy its JSONPath · click a value to copy it


                        

Type a JSONPath expression — results update as you type. Tip: click a key in the Tree tab to fill this in.

Keys
Objects
Arrays
Strings
Numbers
Booleans
Nulls
Depth
Input
Formatted
Minified

Clear error messages

Errors point to the exact line and column, explained in plain words — like “Trailing comma before }”.

One-click repair

Fixes comments, single quotes, unquoted keys, trailing commas, and Python True/None.

Tree, search & JSONPath

Explore big documents, search keys and values, and query with JSONPath.

No precision loss

Long IDs like 12345678901234567890 stay exact. JSON Lines and stringified JSON are read too.

Version 1.1 Updated What's new

Release notes

  1. v1.1 Latest
    • Added an in-depth guide below the tool, written from what the tool actually does.

About the JSON Formatter

The JSON formatter makes JSON readable by adding indentation and line breaks, checks that it is valid, and explains the exact line and column of any error.

How to use it

  1. 1 Paste JSON, upload a .json or .jsonl file, or load it from a URL.
  2. 2 It formats as you type — or press Minify, Repair, or convert it to YAML, XML or CSV.
  3. 3 Fix any errors shown, then copy, download, or share the result.

Frequently asked questions

Is my JSON sent to a server?

No. Formatting and validation run entirely in your browser, so your data never leaves your device. Share links keep the JSON inside the link itself, not on our servers.

What are the most common JSON errors?

Trailing commas, single quotes instead of double quotes, unquoted keys, and comments. None of these are allowed in standard JSON. The Repair button fixes all of them.

What is the difference between formatting and minifying?

Formatting adds spaces and line breaks for people to read. Minifying removes them to make the file as small as possible for sending over a network.

Will long numbers lose precision?

No. Large IDs such as 12345678901234567890 are kept exactly as written, while many formatters silently round them.

Can it read JSON Lines?

Yes. A .jsonl or NDJSON file with one JSON value per line is read as an array, and JSON stored inside a string is unescaped automatically.

How does JSONPath work?

Use $ for the root. $.name reads a top-level key, $.users[0] the first item, $.users[*].email every email, and $..id every id at any depth. Clicking a key in the tree fills in its path.

Pretty print JSON from the command line and in code

# Python (no install needed)
python -m json.tool data.json

# jq
jq . data.json

// JavaScript
JSON.stringify(data, null, 2)

// PHP
json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);

To minify instead, use jq -c . or JSON.stringify(data) with no extra arguments.

Two spaces, four spaces or tabs

JSON does not care about indentation, so pick what your project already uses. Two spaces is the most common style in JavaScript projects and in most API documentation. Four spaces is common in Python and Java code. Tabs make the file a little smaller and let each reader choose the width. For files kept in Git, a stable format also gives cleaner diffs, so format before you commit.

Read JSON with the tree view

A long API response is easier to read as a tree than as text. Fold the objects you do not need, open the one you care about, and click a key to get its JSONPath, ready to use in code or in the JSONPath box. This is the quickest way to answer questions like “where in this response is the user’s email?” without scrolling through thousands of lines.

Formatting changes the layout, never the data

Formatting only adds or removes whitespace between tokens. Keys stay in the same order, strings keep their exact characters, and numbers are not rounded. That is why a formatted file and its minified copy parse to the same value. If you see different data after formatting, the input was not valid JSON to begin with: for example, a duplicate key, where most parsers keep only the last value.