JSON Formatter

JSON Formatter

Paste JSON to format it with clean indentation, or minify it to a single line. You can sort object keys alphabetically, and if the JSON is invalid the formatter shows the line and column of the error. Nothing leaves your browser.

Beautify or minifySort keysError line and columnLast updated: November 3, 2026

Format JSON

What a JSON formatter does

JSON (JavaScript Object Notation) from APIs and config files often arrives as one long line. Formatting (pretty-printing) adds line breaks and indentation so you can read the structure; minifying removes all unnecessary whitespace to make the file smaller. Both keep the data exactly the same.

Same data, two layouts

{"id":7,"tags":["a","b"]}{ "id": 7, "tags": [ "a", "b" ] }

JSON syntax rules

RuleValidInvalid
Keys in double quotes{"name": 1}{name: 1}
Strings in double quotes"text"'text'
No trailing commas[1, 2][1, 2,]
No comments—// note
Allowed valuesstring, number, object, array, true, false, nullundefined, NaN

Common errors

  • Unexpected token: usually a missing comma, a missing quote, or single quotes.
  • Unexpected end of JSON input: a bracket or brace was never closed.
  • Bad control character: a real line break inside a string; use \n instead.

Frequently asked questions

Is it safe to paste API responses with keys or tokens?

The formatter runs entirely in your browser and sends nothing to a server. Still, avoid pasting live secrets into any website you don’t control.

Does sorting keys change my data?

No. JSON objects are unordered, so sorted keys hold the same data. Array order is never changed.

Why are big numbers changed?

Browsers store numbers as 64-bit floating point, so integers above 9,007,199,254,740,991 lose precision. Keep very large IDs as strings.

Scroll to Top