JSON Formatter and Validator

Paste JSON to pretty-print it, check it for syntax errors and browse it as a tree. Nothing to install.

Editor (Formatted View)
1
Ready — paste or type JSON here
Viewer
Tree view will appear here after formatting
Ready

How to format JSON

  1. Paste JSON into the editor, drop a .json file on it, or click Upload.
  2. Click Format (or Ctrl + Enter). Choose 2 spaces, 4 spaces or tabs in the Indent menu.
  3. Check the status bar. A green "Valid JSON" means the syntax is correct; otherwise it tells you where the problem is.
  4. Copy or download the result from the right panel.

JSON rules that catch people out

Most "invalid JSON" errors come from habits carried over from JavaScript or Python. The validator checks for all of these:

Fixing broken JSON

Repair handles unquoted keys, trailing commas, // comments and brackets that were never closed, all in one go. This input:

{name: "Ada", langs: ["en", "fr",],}

comes back as:

{
  "name": "Ada",
  "langs": [
    "en",
    "fr"
  ]
}

Repair doesn't guess at single quotes, missing commas between properties or Python values such as None. For those, the validator points to the line so you can fix it by hand.

Pretty-print or minify?

Pretty-printed JSON is for people. There's one value per line, indented by depth, which makes it easy to read and to compare in a code review. Minified JSON is for machines. It fits on one line and is smaller, which helps in request bodies, environment variables and anywhere a single line is required. After you click Minify, the status bar shows the new size and how many bytes were saved.

Large numbers are kept exactly

JSON itself has no limit on number size, but JavaScript can only store whole numbers exactly up to 9,007,199,254,740,991. Database IDs, social media post IDs and money amounts often go past that. Tools built on JSON.parse round them without telling you. This formatter never converts numbers, so 12345678901234567890 stays 12345678901234567890 and 1.50 stays 1.50.

Finding your way around big documents

Switch the right panel to Tree View to see the structure. Every object shows how many properties it has and every array how many items, so you can find the part you need without scrolling through thousands of lines. In the editor, click the small arrows next to the line numbers to fold a block down to { … }.

Frequently asked questions

What is the difference between a JSON parser, formatter and validator?

A parser reads the text and builds the data from it. A validator tells you whether that worked and, if not, where it failed. A formatter writes the data back out with consistent indentation. This page does all three in one step.

My JSON is valid here, so why does my application still reject it?

The syntax is fine, but the content doesn't match what the application expects: a required field is missing, a number was sent as a string, or the nesting is different. That is a schema problem, not a syntax problem.

Can I format JSON with comments (JSONC)?

Comments aren't valid JSON, so the validator will flag them. Click Repair to strip // comments, then format as usual.

Does it support JSON Lines (NDJSON)?

Not as a single document, because every line is a separate JSON value. Format one line at a time, or wrap the lines in [ ] with commas between them.

Other tools

Share Content

Choose what to share and generate an instant link

🔥 One-time link Content deleted from server after first view
✉️
Uploading to server…