JSON Formatter

Format, validate, and analyze JSON with professional tools and insights.

Input & Settings

Output

Formatted JSON will appear here

Analysis & Stats

JSON statistics will appear here

JSON Formatting Examples

Unformatted Input

{"name":"John","age":30,"city":"New York"}

Pretty Output

{
  "name": "John",
  "age": 30,
  "city": "New York"
}

Additional Examples

Formatting Minified JSON

Input:
{"name":"Alice","age":30,"city":"New York"}

Output:
{
  "name": "Alice",
  "age": 30,
  "city": "New York"
}

Converts a compact, single-line JSON string into a human-readable format with indentation.

Validating and Formatting Complex JSON

Input:
[ { "id": 1, "items": [ "apple", "banana" ] }, { "id": 2, "active": true, "config": null } ]

Output:
[
  {
    "id": 1,
    "items": [
      "apple",
      "banana"
    ]
  },
  {
    "id": 2,
    "active": true,
    "config": null
  }
]

Formats nested arrays and objects with consistent indentation, handling different data types (number, string, boolean, null).

Detecting Syntax Errors

Input:
{
  "name": "Bob",
  "age": 40 // Missing comma
  "isStudent": false
}

The tool will identify the missing comma after the 'age' field and report a validation error.

    Examples

    Beautify minified JSON

    Input
    {"user":{"id":42,"name":"Ada","roles":["admin","editor"]},"active":true}
    Output
    {
      "user": {
        "id": 42,
        "name": "Ada",
        "roles": [
          "admin",
          "editor"
        ]
      },
      "active": true
    }

    A compact, single-line API response reformatted with consistent 2-space indentation.

    Minify for transport

    Input
    {
      "name": "webhook",
      "url": "https://example.com/hook"
    }
    Output
    {"name":"webhook","url":"https://example.com/hook"}

    Strips all whitespace to produce the smallest valid payload for shipping over the wire.

    Invalid JSON is caught, not silently accepted

    Input
    {
      "id": 1,
      "name": "Ada",   // comments are not valid JSON
      "active": true,
    }

    JSON forbids comments and trailing commas — the validator pinpoints the offending line so you fix the real problem instead of chasing a generic parse failure downstream.

    About this tool

    JSON is the lingua franca of APIs and config files, but minified or hand-edited JSON is painful to read and easy to break with a single misplaced comma or bracket. This formatter validates your JSON and re-indents it with consistent spacing and line breaks so nested structures become instantly scannable — and when the syntax is invalid, it points you at the problem instead of failing silently.

    Beyond pretty-printing, it offers minification for shipping compact payloads, search across large documents, useful statistics (key counts, depth, size), and file upload for working with big responses. Everything runs client-side — your data never leaves the browser — so it's safe to format sensitive API responses and configuration.

    How to use

    1. Paste your JSON

      Paste JSON into the input area, or upload a .json file.

    2. Format or minify

      Click Format to indent and beautify, or Minify to collapse it to a single compact line.

    3. Fix any errors

      If the JSON is invalid, the validator reports the syntax error (e.g. a missing comma or bracket) so you can correct it.

    4. Copy or download

      Copy the formatted output or download it for reuse.

    Use cases

    Debugging API responses

    Paste a raw API response and instantly read nested objects instead of squinting at a minified blob.

    Editing config files

    Format a .json config so you can edit it safely, then minify it back before deploying.

    Reviewing large payloads

    Search across and inspect the depth and size of big documents you'd otherwise struggle to navigate.

    Validating hand-written JSON

    Catch a missing comma or quote before your app or CI pipeline rejects the file.

    What the formatter handles

    FeatureWhat it does
    ValidationCatches missing commas, brackets, quotes and trailing characters
    Pretty-printRe-indents with consistent spacing for readability
    MinifyStrips whitespace to produce the smallest valid payload
    StatisticsReports key count, nesting depth and document size
    File uploadLoads large JSON files without pasting

    All processing is client-side — your JSON never leaves the browser.

    Common mistakes

    Mistake:Using single quotes around strings or keys.

    Fix:JSON requires double quotes — "key" and "value", never 'key'.

    Mistake:Leaving a trailing comma after the last item.

    Fix:Remove the trailing comma; JSON forbids it, unlike JavaScript object literals.

    Mistake:Adding // or /* */ comments.

    Fix:JSON has no comments. If you need notes, keep them outside the file or switch to JSONC/JSON5 deliberately.

    Mistake:Trusting formatted JSON without schema validation.

    Fix:Formatting proves the syntax is valid, not that the shape matches your contract — validate types separately.

    Frequently asked questions

    References & standards