TonySkill

JSON formatter

Make JSON readable with clean indentation, or minify it onto one line. Optional key sorting, errors pinpointed to the line. Nothing is uploaded.

Accepted: JSON, CSV, TSV, XML, YAML, YML, TXT, GEOJSON, JSONC · Max 50 MB per file

Processed on your device. Only tools that say so send a file to our server.

Tip: paste text anywhere on the page (Ctrl+V).

How to format JSON

  1. Paste your JSON or drop the file.

  2. Pick the indentation (2 or 4 spaces, tab) or the minified version, and key sorting.

  3. Copy the formatted JSON or download it.

Why use this tool

Clean indentation
2 or 4 spaces or tabs. In XML, comments, CDATA and mixed content (text and tags together) are kept as they are.
Errors explained
A missing comma, a badly closed tag, wrong indentation: the line and column are shown, the line is highlighted and “Go to error” puts the cursor there.
Minification
Compact onto a single line to slim down a file or embed it in code. The downloaded file name ends in .min.
Nothing leaves your device
The conversion runs in your browser: your data is never sent to a server, even 50 MB files.

To format JSON online, paste it or drop the .json file above: it is indented at once (2 spaces, 4 spaces or tab), or compacted onto one line, with optional key sorting. If the JSON is broken, the verdict gives the line and column of the first error and a plain explanation. Everything runs in your browser — an API response or a config full of tokens is not uploaded — and files up to 50 MB are accepted.

The 5 mistakes that break JSON, and what the tool says

MistakeExampleMessage shown
Trailing comma[1, 2,] or {"a": 1,}Extra comma before the closing bracket: JSON does not allow it. (position: the comma itself)
Single quotes{'a': 1}JSON requires double quotes ", not single quotes '.
Comment"a": 1, // noteComments are not allowed in JSON.
Key without quotes{a: 1}Key names must be in double quotes.
Missing comma"a": 1 on one line, "b": 2 on the nextA comma is missing between two items. (position: the start of the next item)

Each message comes with "line X, column Y" and a Go to error button that puts the cursor there. For the first four, a Repair button rewrites the JSON in strict form (comments are dropped, not kept). A missing comma has no automatic repair: fix it by hand. Other messages you may meet: an unclosed string, a text that ends too early (a closing brace or bracket is missing), content after the end of the JSON, a number such as 012 with a leading zero, or an unescaped tab or line break inside a string.

Strict JSON, JSON5 and JSONC

Standard JSON accepts none of the five mistakes above. Two relaxed variants exist: JSONC (JSON with comments, and often trailing commas) is used in some editor and project configuration files, and JSON5 also allows single quotes and keys without quotes. A program expecting plain JSON, such as most APIs and `JSON.parse`, rejects both.

This tool checks and writes strict JSON. Paste a JSONC or JSON5 file and it reports the first relaxed feature as an error; click Repair to get strict JSON, then keep a separate copy if you want to keep your comments.

Two silent traps, tested on the page: a duplicated key ({"a":1,"a":2}) is not reported, the last value wins; and an integer too large for JavaScript, such as 12345678901234567890, comes out as 12345678901234567000 (and 1.0 becomes 1). Check big identifiers before replacing a file.

Formatting options, size and privacy

  • Indentation: 2 spaces, 4 spaces, tab, or minified (one line). The downloaded file ends in .min.json when minified.
  • Sort keys: in the advanced options, alphabetical at every level — handy to compare two versions of a config.
  • Size: files up to 50 MB. A 5 MB test file (60,000 records) was validated in about 1.4 seconds; above 1,000,000 characters the boxes show only an excerpt, the download contains everything.
  • Private: the content you paste or drop is processed in your browser and never sent. The site only counts anonymous page views and events; in our test, no request carried the JSON. Tokens, API keys and passwords in your configuration stay on your device.
  • Next step: JSON to CSV for a spreadsheet, CSV to JSON the other way, JSON to YAML for a config, or the YAML validator for the YAML side.
  • To go between CSV, JSON, XML and YAML in any direction, use the Data converter.

Something wrong with this tool?

Frequently asked questions

How do I format JSON online?

Paste it or drop the .json file on this page. It is indented at once; pick 2 spaces, 4 spaces, tab or minified, then copy or download the result.

Why is my JSON invalid?

The most common causes are a trailing comma, single quotes, a comment, a key without quotes or a missing comma. The tool shows the line and column of the first error with a plain explanation.

Can it fix JSON with comments or trailing commas?

Yes, the Repair button rewrites comments, trailing commas, single quotes and unquoted keys as strict JSON. The comments are removed in the result.

Is my JSON uploaded to a server?

No. The JSON is processed in your browser; only anonymous page-view counts are sent, never the content. API keys and tokens in a config stay on your device.

More data tools

  • XML formatterIndent XML cleanly or compact it. Comments and CDATA kept, badly closed tags reported.FreeNo sign-up
  • Data converterSwitch between data formats: CSV, JSON, XML or YAML. The source format is detected automatically.FreeNo sign-up
  • CSV to JSONEach CSV row becomes a JSON object keyed by the headers. Delimiter detected, numbers and booleans recognised.FreeNo sign-up
  • JSON to CSVA list of JSON objects becomes a CSV table ready for Excel. Nested objects are flattened into columns.FreeNo sign-up
  • CSV editorOpen a CSV in a real spreadsheet: delimiter detected, accents kept, save as CSV or Excel.FreeNo sign-up
  • CSV to XLSXOpen a CSV in Excel without broken accents or columns.FreeNo sign-up