JSON Formatter and Validator Online

Paste JSON and this tool will beautify it with two spaces, four spaces or tabs, minify it back to one line, or tell you exactly which line and column broke the parse — with the offending character quoted, not just a vague “unexpected token”. You can also sort every object key alphabetically to make two payloads diffable, browse the structure as a collapsible tree instead of a wall of text, and convert between JSON and CSV in both directions. A one megabyte payload formats without the tab locking up. Because everything runs locally, you can safely paste an API response containing real customer data.

JSON Formatter and Validator

Parsed in your browser. Payloads never leave the page.

Load an example
Working…

Your formatted output appears here.

Runs fully in your browser. Nothing is uploaded.

How to Use the JSON Formatter

  1. Paste your JSON into the input box, or press Paste sample JSON to try the tool with a small example.
  2. Pick an indent width, then press Beautify. If the JSON is invalid you get the line, the column and the character that caused it instead of output.
  3. Press Minify to strip every space and newline, which is what you want before putting JSON in a config value or a URL.
  4. Use Sort keys when comparing two payloads — sorting both makes a diff show real differences instead of key-order noise.
  5. Open the Tree view tab to explore a large structure by expanding only the branches you care about.
  6. Convert tabular JSON into CSV for a spreadsheet, or paste CSV and convert it the other way.

Features

  • Beautify with two spaces, four spaces or tabs, and minify back to a single line.
  • Error reporting with the exact line and column plus the character that broke the parse.
  • A lazily expanded tree view that stays responsive on large documents.
  • Recursive alphabetical key sorting, which makes two API responses genuinely diffable.
  • Two-way JSON and CSV conversion, with nested objects flattened using dot notation.
  • Local parsing, so API responses containing real customer data stay on your machine.

About This Tool

The single most useful thing a JSON tool can do is tell you where the problem is. The browser's own error messages are inconsistent: one engine reports a character offset, another reports a line and column, and a third just says the token was unexpected. This tool runs its own scanner over the text when a parse fails, and reports the line number, the column number and the character sitting there, so you can go straight to it in your editor.

Four mistakes cause most invalid JSON. A trailing comma after the last item in an object or array, which JavaScript tolerates and JSON does not. Single quotes instead of double quotes. Unquoted keys, which is valid JavaScript object syntax but not valid JSON. And a literal line break inside a string, which must be written as a backslash-n escape. The error report will point at each of these.

Sorting keys deserves more attention than it gets. Two API responses that differ only in key order produce a diff full of false positives. Sorting both recursively, then diffing, shows only the values that actually changed. It is the fastest way to answer “what changed between these two responses?”

CSV conversion assumes what CSV assumes: a flat table. An array of objects converts cleanly, with nested objects flattened to dotted keys such as address.city. Arrays nested inside rows are written as a JSON string in the cell, because there is no sensible way to put a list inside a single CSV field without inventing a convention. Going the other way, every value arrives as a string except numbers and the words true, false and null, which are converted to their JSON types.

Frequently Asked Questions

Is my JSON uploaded to a server?

No. Parsing, formatting and conversion all happen in JavaScript in this tab. You can paste an API response containing production data and nothing leaves your machine. Check the network panel while you format if you want to confirm it.

Why does my JSON say invalid when it looks fine?

Check for a trailing comma after the last item, single quotes instead of double quotes, keys without quotes, or a real line break inside a string value. Those four account for almost every invalid payload. The error message here names the line and column so you can find it quickly.

What is the difference between beautify and minify?

Beautify adds indentation and line breaks so a human can read the structure. Minify removes every optional space and newline to make the payload as small as possible, which is what you want for transmission, config values and storage. The data is identical either way.

How large a file can it handle?

A one megabyte payload formats in well under a second on a typical laptop. Much larger documents work too, but the tree view gets slow past a few megabytes because each expanded branch becomes DOM elements — use the text output for very large files.

Can it convert nested JSON to CSV?

Yes, with a caveat. Nested objects are flattened into dotted column names such as address.city. Arrays inside a row cannot be flattened meaningfully, so they are written into the cell as a JSON string, which keeps the data without inventing a layout.

Related Tools

Hash Generator

Hash text or files with MD5 and SHA, then compare against a checksum.

Open Hash Generator

Case Converter

Switch text between upper, title, camel, snake and kebab case instantly.

Open Case Converter

Word Counter

Count words and characters live with reading time and keyword density.

Open Word Counter

Browse all 20 tools →