Skip to content

JSON Formatter

Beautify or minify JSON with your indentation, sorted keys and exact numbers.

Mode
Runs in your browser — your data is not uploaded.

How to use

  1. Click Paste to load JSON from your clipboard.
  2. Set Mode to Beautify for readable JSON or Minify for compact JSON.
  3. For Beautify, choose 2 spaces, 3 spaces, 4 spaces or Tab under Indent.
  4. Check Sort keys if you want object keys reordered.
  5. Click Copy to copy the Formatted JSON result.

Examples

Beautify an API response with a large order ID

Input
{"orderId":12345678901234567890,"customer":"Alex Morgan","items":[{"sku":"MUG-12","quantity":2}],"total":24.50,"shipped":false}
Output
{
  "orderId": 12345678901234567890,
  "customer": "Alex Morgan",
  "items": [
    {
      "sku": "MUG-12",
      "quantity": 2
    }
  ],
  "total": 24.50,
  "shipped": false
}

Minify an app configuration

Input
{
  "app": "Inventory Dashboard",
  "roles": ["admin", "editor"],
  "notifications": {
    "email": true,
    "sms": false
  }
}
Output
{"app":"Inventory Dashboard","roles":["admin","editor"],"notifications":{"email":true,"sms":false}}

Sort an address with 4-space indentation

Input
{"zip":"10001","city":"New York","address":{"street":"5th Ave","number":350},"country":"US"}
Output
{
    "address": {
        "number": 350,
        "street": "5th Ave"
    },
    "city": "New York",
    "country": "US",
    "zip": "10001"
}

FAQ

Does formatting change my JSON data?

Keys, strings, numbers and escape sequences stay exactly as written. Sort keys reorders every object's keys by character code, not natural order: uppercase comes before lowercase, and a10 comes before a2. Array order stays unchanged.

Why does the JSON formatter show an error?

Invalid JSON leaves the output empty and shows the first error's line and column. Click the error message to jump to it, or click Show all errors & repair → to open your input in JSON Validator.

Can I format JSON with comments or trailing commas?

This formatter accepts strict JSON, so comments, trailing commas, single quotes and unquoted keys cause errors. When all detected errors are allowed in JSON5, a hint links to JSON5 to JSON.

Is my JSON uploaded to a server?

Your JSON is parsed and formatted in your browser; the tool does not send it to a server. Only option settings are saved in localStorage. Opening a related JSON tool temporarily puts the JSON in sessionStorage, where it is removed when the next page reads it.

Can I format large JSON files?

Files larger than 100 MB are rejected. Input up to 1 MB formats live; above that, click Format or press Ctrl/Cmd+Enter to run formatting in a background Web Worker. If your browser runs out of memory, try a smaller file.