JSON Problems

How to Format JSON Online and Read It Easily

Formatting JSON adds indentation and line breaks so nested objects and arrays are easy to read. It changes only whitespace. If the formatter reports an error instead of output, the JSON is invalid and needs fixing first.

Last updated: 2 November 2026

Open JSON Formatter →

Step-by-step

  1. Copy the JSON from your API response, log file or configuration.
  2. Paste it into the JSON Formatter, or load a .json file in the workspace.
  3. Run the formatter. The output uses two-space indentation.
  4. If an error appears, read the message and fix the JSON before formatting again. The guide on fixing invalid JSON lists the common causes.
  5. Copy or download the formatted result.
  6. Use the JSON Minifier when you need to remove the whitespace again for production.

What formatting changes and what it does not

Formatting adds spaces and line breaks. The keys, values and their order stay the same, so formatted and minified JSON describe identical data.

One caution applies to any JavaScript-based JSON tool. Numbers are read as 64-bit floating-point values, so integers above 9,007,199,254,740,991 can lose precision. For example, 12345678901234567890 comes back as 12345678901234567000. If your IDs are that large, store them as strings or check them with a tool that preserves big integers.

Valid JSON in one minute

Most formatting errors come from a few rules that differ from JavaScript objects.

  • Keys and strings use double quotes. Single quotes are not valid.
  • No trailing comma after the last item in an object or array.
  • No comments of any kind.
  • Allowed values are strings, numbers, true, false, null, objects and arrays. undefined and NaN are not valid.

Formatting outside the browser

If you prefer a terminal, python -m json.tool file.json and jq . file.json both pretty-print a file. In a browser console, JSON.stringify(value, null, 2) gives the same two-space layout.

USE THE TOOL

Finish the task with DevUtilityKits

Use the relevant online utility, check the result, and continue with your development workflow.

Open JSON Formatter →Open JSON Validator →Open JSON Minifier →
FAQ

Frequently asked questions

Does formatting change my data?

No. For valid JSON, only whitespace changes. Keys, values and their order stay the same, apart from the large-number precision limit described above.

Why does the formatter show an error?

The input is not valid JSON. Common causes are a trailing comma, single quotes, an unquoted key or a comment. Fix the error shown and run it again.

What is the difference between formatting and minifying?

Formatting adds whitespace to make JSON readable. Minifying removes it to make the file smaller. Both keep the data the same.

Can JSON contain comments?

No. Standard JSON does not allow comments. Remove them, or use a format such as JSON5 or YAML if you need them.