JSON Formatter Online

Format, beautify, validate, and minify JSON.

Input JSON
Output

Paste your raw JSON into the Input box and click Format / Beautify for clean, indented output — or Minify to compress it to a single line. Click Validate to check syntax without changing the data. Everything runs in your browser; nothing is sent to any server.

What is JSON formatting?

JSON (JavaScript Object Notation) is a lightweight data-interchange format defined in RFC 8259. Raw JSON returned from APIs is often a single long line with no whitespace — hard to read and impossible to debug at a glance. Formatting (also called prettifying or beautifying) rewrites that output with consistent indentation and newlines so the structure is immediately visible. This tool uses 2-space indentation, matching the JSON.stringify(obj, null, 2) convention used in most JavaScript projects.

Minification does the reverse: it strips all non-essential whitespace to produce the smallest possible JSON string. Minified JSON is preferred in HTTP request bodies, API payloads, and configuration files where size matters.

How to use this tool

  1. 1Paste or type your JSON into the Input JSON textarea. You can paste a full API response, a config snippet, or any valid JSON string.
  2. 2Click Format / Beautify to indent the JSON, Minify to compress it, or Validate to check whether the JSON is syntactically valid without modifying it.
  3. 3The result appears in the Output box. Click Copy to copy it to your clipboard.

Code examples

JavaScript
const raw = '{"name":"Alice","age":30,"active":true}';
const parsed = JSON.parse(raw);

// Beautify (2-space indent)
const pretty = JSON.stringify(parsed, null, 2);

// Minify
const compact = JSON.stringify(parsed);
Python
import json

raw = '{"name":"Alice","age":30,"active":true}'
obj = json.loads(raw)

# Beautify
pretty = json.dumps(obj, indent=2)

# Minify
compact = json.dumps(obj, separators=(',', ':'))
curl + python (command line)
curl -s https://api.example.com/data | python3 -m json.tool

Frequently asked questions

Is my JSON data sent to a server?
No. All processing runs locally in your browser using JavaScript's native JSON.parse() and JSON.stringify() functions. Nothing leaves your device.
What is the difference between formatting and beautifying?
They mean the same thing. Both terms describe adding indentation and line breaks to compact JSON to make it human-readable.
What causes an "Invalid JSON" error?
The most common causes are: trailing commas after the last element (not permitted in JSON), single-quoted strings (JSON requires double quotes), unquoted object keys, and comments (JSON does not support // or /* */ comments). The error message indicates where parsing failed.
What is minified JSON used for?
Minified JSON removes all unnecessary whitespace. It is used in HTTP request bodies, REST API payloads, embedded configuration, and anywhere that byte count matters — since whitespace can add 20–50% overhead to a formatted document.
Can I use this tool to format API responses from browser DevTools or curl?
Yes. In browser DevTools, go to the Network tab, click a request, select the Response tab, and copy the body. In curl, pipe output directly: curl -s https://... | python3 -m json.tool, or paste the raw output here.
Does JSON allow comments?
No. Standard JSON (RFC 8259) does not support comments. If you need comments in JSON-like config files, consider JSONC (JSON with Comments), used by VS Code's tsconfig.json and settings.json, or HJSON.
Is this tool free?
Yes, 100% free. No account or sign-up required.

Related tools