Skip to content
Filebird

JSON formatter

Format, minify and validate JSON

Files never leave your device

JSON is the format most web services use to send data around, and it is easy to read when it is laid out well and nearly impossible when it arrives as one long line. This tool takes raw JSON from an API response, a config file or a log and turns it into a clean, indented layout. It can also shrink it back down for production, sort the keys, and, when something is wrong, tell you the line and column where parsing failed so you can fix a missing comma without hunting for it.

How to format and check JSON

  1. Paste your JSON into the input area. You can also type it, or copy it from a browser's network panel or a terminal.
  2. Choose Pretty print to add indentation and line breaks, or Minify to remove every unnecessary space.
  3. If an error message appears, read the line and column. The mistake is at or just before that position, often a missing comma or quote on the line above.
  4. Turn on sorted keys if you want a predictable order, for example before comparing two files.
  5. Copy the result or download it as a file once the JSON is valid and in the shape you need.

Options explained

  • Pretty print: Re-indents the data so that every object and array opens on its own level. It does not change values or order, only whitespace. Use it for reading, reviewing and editing.
  • Minify: Removes all whitespace outside strings. The data is identical but smaller, which suits payloads, embedded config and anything sent over a network.
  • Validate: The input is parsed by the same standard JSON parser browsers use. If it parses, it is valid; if not, you get a message with the line and column of the problem.
  • Sort keys: Orders the keys of each object alphabetically. Arrays keep their order because their order carries meaning. Sorting makes two similar documents easy to compare with Text diff.
  • Copy and download: Take the output to your clipboard or save it as a .json file.

Tips and common problems

Trailing commas are not allowed: A comma after the last item in an object or array is fine in JavaScript but invalid JSON. It is one of the most common errors reported.

Keys and strings need double quotes: Single quotes, unquoted keys and curly "smart" quotes pasted from word processors are all rejected. If the error points at an opening quote, check what kind of quote it is.

Comments are not part of JSON: Lines starting with // or blocks in /* */ will fail validation. Remove them first, or keep a commented copy separately. For beginners, JSON for beginners explains the rules.

Numbers have limits: Very large integers lose precision when parsed by JavaScript, since they are read as floating point numbers. IDs longer than about sixteen digits should be treated as strings in the source data.

Duplicate keys do not warn you: If an object lists the same key twice, parsers silently keep one value, usually the last. Formatting will drop the earlier one, so check the original if you suspect duplicates.

Unicode is fine: Arabic text, accented letters and emoji display normally, and an escape sequence for a character means the same thing to a parser as the character itself.

Encoded content inside values: If a string value is a blob of encoded text, you can decode it separately with Base64 encoder.

Your files stay on your device

JSON is parsed and formatted entirely by your browser. Tokens, customer records and private configuration that you paste are never uploaded or logged, which is important because API responses often contain sensitive data. Nothing extra is downloaded to do the work. Learn more on the How it works page.

Frequently asked questions

Why does the validator say "unexpected token"?

The parser found a character where the grammar does not allow it, such as a trailing comma, a single quote or a stray comment. Look at the reported line and column, and check the character just before it.

Does formatting change my data?

No. Pretty print and minify change only whitespace. Sorting keys changes the order of keys inside objects, which does not alter the meaning, but it does change how the file looks.

Can it fix broken JSON automatically?

No. It points you to where the problem is, but you decide how to correct it. Guessing a repair could silently change your data.

What is the difference between JSON and a JavaScript object?

JSON is a strict text format with required double quotes and no comments, functions or trailing commas. A JavaScript object literal is code and allows more.

Is there a size limit?

No fixed limit. Files of several megabytes work on most devices, but very large documents may make the page slow because the whole text is held in memory.

Why did my big number change?

Numbers beyond JavaScript's safe integer range cannot be represented exactly when parsed, so digits can change. If exact values matter, keep those fields as strings in your data.