All tools

JSON Formatter & Validator

Beautify, minify, and validate JSON with syntax highlighting and clear error messages.

Indent:
Input
Output
Formatted output will appear here

Your JSON is processed entirely in your browser using the built-in JavaScript engine. Nothing is uploaded to CodeAva servers and nothing is stored between sessions.

Overview

JSON (JavaScript Object Notation) is the most widely used data interchange format in modern APIs, configuration files, and data pipelines. Raw JSON is often minified, poorly indented, or returned in a single long line that is difficult to read. This tool formats it into structured, indented output with syntax highlighting so you can read, audit, and debug it quickly.

The validator parses your input using the browser's native JSON.parseand returns the exact error message including position — which is often more useful than generic "invalid JSON" feedback. The minifier strips all whitespace to produce the smallest valid JSON string, useful for reducing payload size or preparing data for storage.

Formatting and validation here are strict: this tool follows the JSON specification (RFC 8259). That means trailing commas, single-quoted strings, comments, and JavaScript-specific syntax are all considered invalid. If you need to work with those patterns, you may be dealing with JSON5 or a non-standard dialect.

Use cases

When to use it

  • API response debuggingpaste a minified response body and read it clearly.
  • Config file validationcatch syntax errors in package.json, tsconfig.json, or similar before committing.
  • Payload preparationformat JSON before including it in documentation or bug reports.
  • Minifying for productionstrip whitespace from JSON to reduce transfer size.

When it's not enough

  • JSON5 or JSONCcomments and trailing commas are not valid JSON — this tool will reject them.
  • Very large filesbrowser tools have practical limits; multi-MB JSON payloads may be slow or unresponsive.
  • Schema validationthis tool checks syntax only — it does not validate against a JSON Schema definition.

How to use it

  1. 1

    Paste your JSON

    Copy the raw JSON string from your API client, terminal, or editor and paste it into the input panel.

  2. 2

    Choose an action

    Click Format to beautify with indentation, Minify to compact it, or Validate to check syntax without changing the output.

  3. 3

    Select indent size

    Choose 2 or 4 spaces depending on your team's convention. The output updates immediately.

  4. 4

    Review the output

    If the JSON is valid, the formatted result appears with syntax highlighting. If not, the exact parse error is shown.

  5. 5

    Copy the result

    Use the copy button on the output panel to copy the formatted or minified JSON to your clipboard.

Common errors and fixes

Unexpected token — trailing comma

JSON does not allow trailing commas after the last item in an object or array. Remove the comma before the closing } or ] bracket.

Unexpected token — single quotes

JSON requires double quotes for all strings and property names. Replace all single quotes with double quotes.

Unexpected end of JSON input

The JSON is incomplete — a closing bracket, brace, or quote is missing. Check that you copied the full response body.

Duplicate key in object

JSON technically allows duplicate keys but most parsers take the last value. The formatter may silently deduplicate. Check your source data for repeated keys.

Invalid escape sequence

Only a specific set of escape sequences are valid in JSON strings (\n, \t, \\, \", etc.). Unrecognised sequences like \q will cause a parse error.

Frequently asked questions