JSON Formatter

Format, validate, explore and query JSON

Formatted JSON will appear here...

About this tool

The ToolNinja JSON Formatter is a free online JSON formatter, validator and beautifier. Paste any JSON string and instantly format it with proper indentation, syntax highlighting, and clear error messages if your JSON is invalid. Use it as a JSON beautifier to make minified API responses readable, as a JSON validator to catch syntax errors like trailing commas, unquoted keys, or mismatched brackets, or as a JSON minifier to compress formatted JSON for production use. The tree view mode lets you explore deeply nested structures visually, and JSONPath query support lets you extract specific values without writing any code. Whether you're debugging an API response, validating config files, or pretty printing JSON for documentation โ€” the ToolNinja JSON formatter handles it instantly with no page reloads. Everything runs 100% in your browser. Your JSON data โ€” including any sensitive API keys, tokens or private data โ€” never leaves your machine. No login required.

When to use it

  • โ†’Inspecting API responses from Postman, curl, or browser DevTools
  • โ†’Formatting config files (package.json, tsconfig.json) before committing
  • โ†’Debugging serialized data from logs, queues, or databases
  • โ†’Minifying JSON before storing in environment variables or payloads

Tips

  • โ—†Paste minified JSON and it auto-formats on input โ€” no button required.
  • โ—†Use the Minify button to compress JSON for size-sensitive environments.
  • โ—†The error indicator shows the exact line and character of syntax problems.

Frequently asked questions

What's the difference between JSON formatting and minification?

Formatting adds whitespace and indentation to make JSON human-readable. Minification strips all unnecessary whitespace to reduce file size โ€” useful for API payloads, localStorage, and environment variables where every byte matters.

Why does my JSON show a validation error?

The most common causes are: trailing commas after the last array item or object key (invalid in JSON, valid in JS), single-quoted strings (JSON requires double quotes), unquoted object keys, or undefined/NaN values (not valid JSON types).

Is my data sent to a server when I paste it here?

No. The formatter runs entirely in your browser using JavaScript. Your JSON never leaves your device. There are no analytics, no logging, and no server-side processing of any kind.

Can I format JSON that contains comments?

Standard JSON does not allow comments. If your file is JSONC (JSON with Comments), used by tsconfig.json and VS Code settings, you'll need to strip the comments first. The formatter will flag them as syntax errors.

Related tools

๐Ÿฅท ToolNinja