JSON Formatter and Validator
The JSON formatter pretty-prints, validates and minifies JSON in one place. Paste a blob to indent it for reading, strip it down for shipping, or sort keys for clean diffs, and get an instant valid or invalid check with a line and column hint when something is off. Everything runs in your browser, so even sensitive payloads stay on your machine.
How to format JSON
- Paste your JSON into the editor, or click 'Load sample' to try it.
- Choose 'pretty' to indent or 'minify' to strip whitespace.
- In pretty mode, set the indent to 2 or 4 spaces.
- Toggle 'Sort keys' to order keys alphabetically at every level.
- Check the valid or invalid indicator, then Copy or Download the result.
Examples
Pretty-print
{"name":"Ada","skills":["math","logic"]}{
"name": "Ada",
"skills": [
"math",
"logic"
]
}Minify
{
"a": 1,
"b": 2
}{"a":1,"b":2}Sort keys
{"b":1,"a":2}{
"a": 2,
"b": 1
}Frequently asked questions
Does this validate JSON too?
Yes. As you type, the tool parses the input and shows a green 'Valid JSON' badge or the parser's error message. When the position is known it adds a line and column hint so you can jump straight to the problem.
Is my JSON sent to a server?
No. Formatting, validation and minifying all happen locally in your browser using the built-in JSON parser, so your data never leaves your device. That makes it safe for API responses and configs that contain secrets.
What is the difference between pretty and minify?
Pretty mode indents the JSON across multiple lines so people can read and review it. Minify removes every optional space and newline to produce the smallest valid string, which is what you want for storage or sending over the wire.
Can I sort object keys?
Yes. Turn on 'Sort keys' to order keys alphabetically at every nesting level. Array element order is always preserved, since order is meaningful in arrays. Sorting keys makes two versions of the same object diff cleanly.
What indentation can I use?
Two or four spaces in pretty mode, whichever your team prefers. In minify mode the indent setting is disabled because all whitespace is stripped.
How does the line and column hint work?
When the parser reports a character position for the error, the tool counts newlines up to that point to translate it into a line and column. That points you at the exact bracket, comma or quote that broke parsing.
Will formatting change my numbers?
It reformats whitespace and, if you ask, key order, but parsing does normalize numbers. A value like 1.0 becomes 1 and a very large integer beyond safe precision may lose exactness, because JSON numbers are read as standard doubles.
Does it accept comments or trailing commas?
No. This is a strict JSON formatter, so comments, single quotes and trailing commas are reported as errors. Those belong to JSON5 or JavaScript object literals, not to the JSON specification.
Can it handle large files?
Yes, within your device memory. Because it runs in the browser, very large documents depend on available RAM, but typical API payloads format instantly.
Learn more
- Common JSON errors and how to fix them
Trailing commas, single quotes, unquoted keys and other JSON mistakes, with quick fixes and how to read the error hint.
Related tools
JSON to CSV
Convert JSON to CSV online. Paste an array of objects and get clean, spreadsheet-ready CSV with the right headers. Runs in your browser.
CSV to JSON
Convert CSV to JSON online. Turn spreadsheet rows into clean JSON objects or arrays, with smart number and boolean typing. Free tier plus API.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
ASCII Table
Full ASCII table for all 128 codes with decimal, hex, octal and binary values, character names and descriptions. Search by code, hex or character.
Aspect Ratio Box Generator
Generate CSS for a responsive aspect-ratio container. Use the modern aspect-ratio property or the padding-top fallback, then copy the ready code.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.