/json

JSON Formatter, Validator & Beautifier (Local)

Format, validate, prettify, and minify JSON data in a tree viewer locally and securely.

About this tool

JSON (JavaScript Object Notation) is the modern standard for exchanging data between systems. It is lightweight, human-readable, and supported by virtually every programming language. This formatter validates your JSON, shows any syntax errors with their position, and lets you either pretty-print it with indentation or minify it to a single line. Everything runs locally in your browser, no JSON data ever leaves your machine.

How to use it

  1. Paste or type your JSON in the input area.
  2. Press "Format" for nicely indented output, or "Minify" to compress it into one line.
  3. Pick the indent size (2 spaces, 4 spaces, or tab).
  4. On errors, the line and column are shown so you can locate the problem quickly.
  5. Press "Copy" to put the result on your clipboard.

Examples

Minified → formatted
Input{"name":"Ola","age":30,"tags":["dev","norge"]}
Output{ "name": "Ola", "age": 30, "tags": [ "dev", "norge" ] }
Nested object
Input{"user":{"id":42,"email":"ola@example.com"},"active":true}
Output{ "user": { "id": 42, "email": "ola@example.com" }, "active": true }
Common error: single quotes
Input{'name': 'Ola'}
JSON requires double quotes around both keys and string values. `{"name":"Ola"}` is valid; single quotes are not.

Common use cases

  • Debugging API responses from a backend during development.
  • Making long, compressed JSON payloads readable in log files or the browser DevTools.
  • Minifying JSON before sending it over the network to save bandwidth.
  • Verifying that a configuration file (`.json`, `package.json`, `tsconfig.json`) is syntactically valid.
  • Switching between a reading-friendly style (formatted) and a storage-friendly style (minified).
  • Comparing two JSON structures by normalising their formatting first.

Frequently asked questions

Why do I get "Unexpected token" even though my JSON looks right?
The most common causes are: single quotes instead of double, comments (JSON does not support `//` or `/* */`), trailing commas after the last element, or unquoted keys. JSON is stricter than JavaScript object literals.
Does the tool preserve key order?
Yes. The formatter uses `JSON.parse` and `JSON.stringify`, which preserve insertion order for keys in modern browsers. The JSON standard does not guarantee order, but in practice it works.
How large a JSON can I paste?
The tool parses locally, so the limit is essentially how much text your browser can handle in a textarea, typically several megabytes without issue. For truly huge files (100+ MB) a command-line tool like `jq` will be faster.
Can I convert JSON to CSV or YAML here?
Not in this tool, but see "CSV ↔ JSON", "YAML ↔ JSON" and "XML ↔ JSON" in the menu for converting between formats, also fully local.

Technical background

JSON was originally specified by Douglas Crockford and is now standardised in RFC 8259 and ECMA-404. Its data types are limited to objects, arrays, strings, numbers, booleans and `null`, no dates, functions or circular references. The format is a strict subset of JavaScript, which makes it safe to parse with `JSON.parse` in every modern browser.