Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

JSON Formatter

Pretty-print, minify and fix JSON with exact error locations.

Developer No upload Works offline Free, no sign-up

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

  1. Paste or type JSON into the input box, or use Open file to load a .json file from your device.
  2. Choose the indentation (2 spaces, 4 spaces or tabs) and, if you like, turn on Sort keys.
  3. Press Format (or Ctrl/⌘ + Enter) to pretty-print, or Minify to remove all whitespace.
  4. Copy the result or download it as a .json file.

Examples

Pretty-print a compact API response
Input
{"id":7,"name":"Asha","roles":["admin","editor"],"active":true}
Result
{
  "id": 7,
  "name": "Asha",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true
}
Find a syntax error
Input
{
  "a": 1,
  "b": 2,
}
Result
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.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.