Skip to content
cliplimeClipLime

Format and validate JSON

Paste JSON, get it indented, checked and ready to copy. Errors say the line and column, and nothing leaves this tab.

Your text is processed in this tab and never uploaded

Options

Read JSONC, as used in config files. Comments are dropped from the result.

0 characters, 0 lines Your text stays in this tab.

Numbers and strings are kept exactly as you wrote them, so long IDs and values like 1.0 are not rounded or rewritten.

At a glance

What it does
Formats, minifies and validates JSON as you type.
Indent
2 spaces, 4 spaces or tabs, with optional A to Z or Z to A sorting of property names.
Numbers and strings
Kept exactly as written, so long IDs and values like 1.0 are not rounded or rewritten.
Errors
The line and column, the faulty line, a likely cause, and a button that jumps to it.
Comments
An error in standard mode. A relaxed option reads comments and trailing commas (JSONC).
Size
Updates while you type up to 2 million characters. Larger input runs when you press the button.
Privacy
Runs in your browser tab. Your JSON is never uploaded.

How to do it

  1. 1

    Paste or load your JSON

    Paste into the left box, drop a .json file on it, or press Example to see how it works.

  2. 2

    Choose what to do

    Pick Format, Minify or Validate, then an indent and whether to sort property names.

  3. 3

    Read the result

    The result updates as you type. If the JSON is invalid you get the line, the column, a likely cause and a Go to line button.

  4. 4

    Copy or download

    Copy the result, download it as a file, or press Use result as input to run another pass on it.

Format, minify or validate: which one you need

The three modes answer different questions, and the same text can need all of them in turn.

  • Format adds line breaks and indentation so a person can read nested data. Use it to inspect an API response, a log line or a config file.
  • Minify removes every space and line break that is not inside a string. Use it when size matters, such as a request body, an environment variable or a value stored in a URL. The JSON minifier page covers what is and is not removed.
  • Validate checks the syntax and reports what is in the document without rewriting it. The JSON validator page explains what that check covers.

Why your numbers are not rounded

Many tools read JSON into JavaScript values and write it back. That quietly changes data. JavaScript numbers are 64 bit floating point values, so an integer above 9,007,199,254,740,991 cannot be stored exactly, and 1.0 comes back as 1.

This formatter reads the text itself and copies each number and string as you wrote it. Only the white space around them changes. Escapes such as \u00e9 stay as typed, and duplicate keys are kept and reported rather than dropped.

If a number has more digits than a JavaScript number can hold, you get a note, because a program that reads that JSON with JSON.parse will round it. IDs that must stay exact are safer written as strings.

What the error messages mean

JSON is stricter than the JavaScript it came from. These are the problems people hit most, and how they show up here:

  • A comma is missing before this property. Two values sit side by side. The cause is usually at the end of the previous line.
  • Trailing comma. A comma after the last item. It is allowed in JavaScript but not in JSON.
  • Property names must be in double quotes. Single quotes and bare names such as {name: 1} are JavaScript, not JSON.
  • Comments are not allowed. Standard JSON has no comments. Turn on the relaxed option for files such as tsconfig.json.
  • True must be written in lowercase. Python's True, False and None, and JavaScript's undefined and NaN, are not JSON values.
  • Extra content after the end. A file with one JSON value per line (JSON Lines) is not one document. Put the lines in an array with commas between them.

Large files and key sorting

Up to 2 million characters the result updates while you type. Longer text waits for the Format now button, so the page does not freeze while you paste. How long a big file takes depends on your device.

Sorting orders property names by character code, so capital letters come before lowercase ones, and it applies at every level. The order of items inside arrays is never changed. Sorted output is handy for comparing two objects that list the same keys in a different order.

Questions people ask

Is my JSON sent to a server?

No. The code runs in your browser tab and your text is never sent anywhere. That matters for API responses and config files that contain tokens or customer data.

Why does it say comments are not allowed?

The JSON standard (RFC 8259) has no comments. Files such as tsconfig.json and VS Code settings use a relaxed form called JSONC. Turn on Allow comments and trailing commas to read them. Comments are dropped from the result, because standard JSON cannot hold them.

Does sorting keys change what my JSON means?

For almost every use, no: the JSON specification treats an object as an unordered set of members. A few programs do depend on key order, so check before you sort a file that something else reads. Arrays are never reordered.

Can it repair broken JSON?

No. It points to the first problem and says what is likely wrong, but it does not guess a fix, because a wrong guess can change your data without you noticing. Fix the line it shows and the result updates.

How is this different from JSON.parse and JSON.stringify?

Those read the text into JavaScript values, which rounds big numbers, turns 1.0 into 1 and keeps only the last of two duplicate keys. This tool keeps the text of every value as written and reports duplicates. It also tells you the line and column of an error in every browser.

Does it support JSON5?

No. The relaxed option adds only comments and trailing commas. JSON5 features such as unquoted names, single quoted strings and hexadecimal numbers are reported as errors.