- Tools
- JSON Formatter & Validator
Free tool
JSON Formatter & Validator
Paste JSON to beautify it, check that it is valid, sort its keys, or minify it. The result updates as you type, and everything runs in your browser.
{
"name": "Alice Ng",
"age": 30,
"active": true,
"roles": [
"admin",
"editor"
],
"address": {
"city": "London",
"postcode": "E1 6AN"
},
"projects": [
{
"id": 1,
"name": "Atlas"
},
{
"id": 2,
"name": "Beacon"
}
]
}Make JSON readable, or make it valid
JSON is easy for machines and hard for eyes, especially when it arrives on one long line from a log or an API. Formatting it puts each field on its own line with consistent indentation, so the shape of the data becomes clear and you can find the value you are looking for.
Just as often the question is whether the JSON is valid at all. This tool answers that instantly. A valid document gets a green badge and a formatted result. An invalid one gets the parser error, so you can jump to the trailing comma or missing bracket that broke it.
Indent, sort, or minify
Pick the indentation your project uses, two spaces, four spaces, or tabs, and the output matches it. Turn on Sort keys to reorder every object alphabetically at every level, which is the quickest way to make two JSON documents line up so you can spot the real differences between them.
When you need the opposite of readable, the minify option strips all whitespace and returns the smallest valid JSON on a single line, ready to embed in a request body or a config value.
Handy for JSON columns
Databases store JSON too. A value from a PostgreSQL JSONB column or a MySQL JSON column comes back as a single compact string, which is hard to read in a result grid. Paste it here to expand it, confirm it is well formed, and read the nested structure.
All of this happens in your browser, so a payload with real data stays on your machine. Nothing is uploaded, and nothing is stored once you leave the page.
Frequently asked questions
- How do I format JSON?
- Paste your JSON into the left pane. If it is valid, the right pane shows it formatted with consistent indentation and line breaks. Choose two spaces, four spaces, or tabs, or switch to minify to strip all whitespace into a single line.
- How does the validator work?
- The tool parses your input the moment you paste or type it. If it is valid, you see a Valid JSON badge. If not, it shows the parser error message so you can find the problem, which is usually a trailing comma, a missing quote, or an unclosed bracket.
- What does sorting keys do?
- With Sort keys turned on, every object has its keys reordered alphabetically, at every level of nesting. That makes two JSON documents easy to compare, since the same fields line up regardless of the order they were written in.
- What is the difference between formatting and minifying?
- Formatting adds indentation and line breaks so the structure is easy to read. Minifying does the opposite: it removes every space and newline to produce the smallest valid JSON, which is what you want when sending it over the wire or storing it compactly.
- Is my JSON sent to a server?
- No. The formatting and validation run as JavaScript in your browser, so your data never leaves your machine. You can safely paste JSON that contains private values.
- Does it work with JSON from a database column?
- Yes. JSON pulled from a PostgreSQL JSONB column or a MySQL JSON column is ordinary JSON, so it formats and validates the same way. This is a quick way to read a value that came back on a single line.
More free tools
Read JSON columns in DB Pro
Formatting a value you pasted is one thing. DB Pro does it in place: it expands and pretty-prints JSON and JSONB columns right in the data browser, so you can read nested values without copying them anywhere. It is a desktop database client for macOS, Windows, and Linux that works with PostgreSQL, MySQL, SQLite, and more.
Turning JSON into a table instead? Try the JSON to SQL converter, browse the other free tools, or read the database tutorials.