JSON Formatter & Minifier

Beautify or minify JSON instantly with a configurable indent size of 2, 4, or 8 spaces, an optional key-sort to normalize object ordering, and one-click validation that reports the exact parse error if the input is malformed. Switch between format and minify modes without losing your input, then copy or download the result. All processing happens in your browser.

Input

JSON

Indent

Options

6 keys
Output

Formatted JSON

What is JSON Formatter & Beautifier?

A single misplaced comma or an unclosed bracket can make a 500-line JSON response completely unreadable to a parser — and finding it by eye in a wall of compact text is painful. This formatter solves both problems: it validates your JSON and reports the exact line and character position of any syntax error, and it reformats valid JSON with consistent indentation and syntax highlighting so the structure is immediately legible. Toggle between 2-space, 4-space, and tab indentation. Enable key sorting to produce alphabetically ordered, diff-friendly output. Minify mode strips all whitespace for production payloads or environment variable storage. A collapsible tree view lets you fold any nested object or array to navigate large documents. Lenient mode accepts JSON5-style input with comments and trailing commas, converting it to strict RFC 8259 output.

How to Use

  1. 1

    Paste Your JSON

    Paste minified, compact, or malformed JSON into the left panel. The formatter accepts single-line API responses, escaped JSON strings, and JSON with trailing commas or comments (with lenient mode enabled).

  2. 2

    Set Formatting Options

    Choose indentation (2-space, 4-space, or tab), toggle key sorting for consistent diff-friendly output, enable minification mode for single-line compact output, and set the colour theme for syntax highlighting.

  3. 3

    Format or Validate

    Click "Format". Syntax errors are highlighted at the exact line and character position. Valid JSON is indented, syntax-highlighted, and shown in the output panel with a collapsible tree view.

  4. 4

    Copy or Download

    Copy the formatted JSON to your clipboard for pasting into your code editor, REST client, or config file — or download it as a .json file.

Common Use Cases

API Response Debugging

Paste minified or compact JSON from a network request or curl response to instantly beautify it with proper indentation, making the structure easy to read and navigate.

Configuration File Editing

Format dense JSON configuration files — package.json, tsconfig.json, .eslintrc — with consistent indentation before committing to version control or reviewing in code review.

JSON Validation

Paste any JSON string to instantly check whether it is syntactically valid. The formatter highlights the exact line and character position of syntax errors, saving manual debugging time.

Minification for Production

Strip all whitespace and comments from a development JSON config to produce a compact single-line version for embedding in HTTP responses, localStorage, or environment variables.

Conversion Examples

Minified JSON → Formatted

Expand a compact single-line API response into readable indented JSON.

Input JSON

{"user":{"id":1,"name":"Alice","roles":["admin","editor"],"address":{"city":"London","zip":"EC1A"}}}

Output CSV

{
  "user": {
    "id": 1,
    "name": "Alice",
    "roles": [
      "admin",
      "editor"
    ],
    "address": {
      "city": "London",
      "zip": "EC1A"
    }
  }
}

Formatted JSON → Minified

Compress pretty-printed JSON to a single line for production use.

Input JSON

{
  "api_key": "abc123",
  "timeout": 30,
  "retry": true
}

Output CSV

{"api_key":"abc123","timeout":30,"retry":true}

Frequently Asked Questions