JSON Formatter
Pretty-print, minify and fix JSON with exact error locations.
About the JSON Formatter
Paste JSON from an API response, log file or config and get it neatly indented in one click — or minified onto a single line for sending over the wire.
If the JSON is broken, the formatter points to the exact line and column and explains the problem in plain words ("Trailing comma is not allowed before '}'"), so you can fix it quickly. Numbers are kept exactly as written: large IDs like 12345678901234567890 do not lose precision the way they do with JSON.parse.
How to use it
- Paste or type JSON into the input box, or use Open file to load a
.jsonfile from your device. - Choose the indentation (2 spaces, 4 spaces or tabs) and, if you like, turn on Sort keys.
- Press Format (or Ctrl/⌘ + Enter) to pretty-print, or Minify to remove all whitespace.
- Copy the result or download it as a
.jsonfile.
Examples
{"id":7,"name":"Asha","roles":["admin","editor"],"active":true}{
"id": 7,
"name": "Asha",
"roles": [
"admin",
"editor"
],
"active": true
}{
"a": 1,
"b": 2,
}Line 4, column 1: Trailing comma is not allowed before '}'
Remove the comma after 2 and the JSON becomes valid.
Common uses
- Reading minified API responses while debugging.
- Cleaning up configuration files (package.json, tsconfig.json, app settings) before committing.
- Minifying JSON payloads to reduce request size.
- Producing stable, sorted output so that diffs between two versions are easy to read.
What counts as valid JSON
JSON is stricter than JavaScript. Property names and strings must use double quotes, trailing commas are not allowed, and comments are not part of the format. The only literal values are true, false and null (lower case). Numbers cannot have leading zeros, a leading +, or be NaN/Infinity.
This formatter follows RFC 8259 exactly, so anything it accepts will be accepted by any standards-compliant parser.
Limitations
- Very large documents (tens of megabytes) are formatted in your browser and may take a few seconds on older phones.
- Comments and trailing commas (JSON5/JSONC) are reported as errors rather than silently removed, because standard parsers reject them.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.
Frequently asked questions
Is my JSON sent to a server?
No. Formatting and validation run entirely in your browser. You can even disconnect from the internet after the page loads and it will keep working.
Why does my number change in other formatters but not here?
Most online formatters use JSON.parse, which converts numbers to 64-bit floating point and loses precision beyond 15–17 significant digits. This tool keeps every number exactly as you typed it.
What does "Sort keys" do?
It orders the properties of every object alphabetically (by Unicode code point). Arrays keep their order because the position of array items is meaningful.
What happens to duplicate keys?
They are kept in the output, and the tool warns you about them. Most parsers keep only the last value for a duplicated key, which is usually a bug.