Skip to content
Kordu Tools
Developer Tools Runs in browser Updated 30 Mar 2026

JSON Formatter

Format, validate, and minify JSON instantly — with configurable indentation, error location, and tree view.

Indent:
Loading rating…

How to use JSON Formatter

  1. Paste your JSON

    Paste or type your JSON data into the input panel on the left. The formatter validates your JSON in real time as you type.

  2. Choose your indent style

    Select 2 spaces, 4 spaces, or tab indentation using the buttons above the output panel to match your project's code style.

  3. Format or minify

    Click Format to beautify your JSON with indentation, or Minify to compress it to a single line for production use.

  4. Use tree view for exploration

    Switch to Tree View to navigate nested objects and arrays by expanding and collapsing nodes — useful for deep API responses.

  5. Copy the result

    Click Copy to copy the formatted or minified output to your clipboard, ready to paste into your editor or terminal.

JSON Formatter FAQ

Is my data sent to a server?

No. All formatting and validation happens in your browser using native JSON.parse and JSON.stringify. Your data never leaves your device.

What happens if my JSON is invalid?

The tool displays an error message with the exact line number and column position where the syntax error occurs, so you can find and fix the issue quickly.

Can I minify JSON as well as format it?

Yes. Click Format to beautify with indentation, or Minify to remove all whitespace and produce compact single-line output suitable for HTTP payloads and storage.

Does it handle JSON with comments (JSONC)?

Standard JSON does not allow comments. If your input contains // or /* */ comments (as used in tsconfig.json or VS Code settings), they will cause a parse error. Strip comments before formatting, or use a JSONC-aware editor.

Can I sort JSON keys alphabetically?

Yes. Toggle Sort Keys to reorder all object keys alphabetically throughout the entire document. Useful for normalising config files and producing deterministic output for diffs.

What is the largest JSON file this can format?

There is no enforced size limit. Very large files (over 10 MB) may be slow to format in the browser. For very large JSON, consider using jq on the command line for better performance.

Can I use this to validate JSON config files?

Yes. Paste your package.json, tsconfig.json, or any JSON config file to validate syntax. Note that JSON Schema validation (checking required fields and types) is not included — this tool validates JSON syntax only.

How is tree view different from formatted text view?

Tree view renders the JSON as a collapsible node tree, letting you expand or collapse nested objects and arrays independently. Formatted text view shows the full indented JSON as copyable text. Use tree view for exploring structure, text view for copying.

Does this support JSON5 or YAML?

This tool handles standard JSON (RFC 8259) only. For YAML, use the YAML to JSON Converter tool. For JSON5 (which allows comments, trailing commas, and unquoted keys), convert it to standard JSON first.

Background

JSON Formatter is the fastest way to clean up JSON data. Paste minified API responses, config files, or hand-edited JSON and click Format to get a neatly indented, readable output. Choose between 2-space, 4-space, or tab indentation to match your project's code style. Click Minify to compress JSON to a single line for embedding in code, config, or HTTP payloads.

Syntax validation runs on every keystroke. When your JSON has an error, the tool reports the exact line number and column position so you can find and fix the issue immediately — no cryptic "unexpected token" message without context.

A JSON tree view lets you navigate deeply nested structures by expanding and collapsing nodes, making it easy to explore complex API responses without scrolling through hundreds of lines. Sort object keys alphabetically or keep the original order.

Common use cases: formatting API responses from cURL or Postman, validating JSON config files before deployment, minifying JSON for storage or transfer, and debugging nested data structures. All processing runs client-side using native JSON.parse and JSON.stringify — your data never leaves your browser.

Learn more