JSON Formatter & Validator

Paste JSON to format, validate, or minify it. Syntax errors are pinpointed by line and column, and a collapsible tree makes large documents easy to explore.

  • Error line & column
  • Tree view
  • Sort keys
Input
Formatted JSON appears here.
How to use

How to use JSON Formatter & Validator

  1. 01

    Paste or upload JSON

    Paste JSON, drop a .json file, or load the sample.

  2. 02

    Format or minify

    Choose an indentation and format, minify to one line, or sort keys alphabetically.

  3. 03

    Debug and explore

    Jump straight to errors, browse the tree view, and copy or download the result.

Guide

About JSON Formatter & Validator

JSON Formatter turns a wall of compressed JSON into clean, indented, readable data. It also validates it, points to the exact line and column of any error, and lets you explore large documents in a collapsible tree.

How it works

Your input is parsed with the browser's strict, standards-compliant JSON parser. If it's valid, it's re-serialized with the indentation you choose (2 spaces, 4 spaces or tabs), minified to a single line, or rebuilt with keys sorted alphabetically. If it's invalid, the error position is converted into a line and column so you can jump straight to the problem.

The Repair button handles the mistakes people make most often when JSON is written by hand or copied from JavaScript: trailing commas, single quotes, unquoted keys and comments. After repairing, the result is validated again.

Common JSON errors

  • Trailing commas: [1, 2, 3,] is valid JavaScript but not valid JSON.
  • Single quotes: strings and keys must use double quotes: "name", not 'name'.
  • Unquoted keys: {name: "Ana"} must be {"name": "Ana"}.
  • Comments: // and /* */ aren't allowed in standard JSON.
  • Special values: undefined, NaN and functions don't exist in JSON. Use null.

What you can use it for

  • Read and debug API responses and webhook payloads.
  • Clean up config files such as package.json, tsconfig.json or app settings.
  • Minify JSON before embedding it in code or sending it over the network.
  • Sort keys to make two JSON files easy to compare in a diff.

Safe for sensitive data: API responses often contain tokens and personal data. Many online formatters send your input to a server. This one never does.

At a glance

Actions
Format, minify, validate, sort keys
Indent
2 spaces, 4 spaces or tabs
Errors
Exact line and column
Repair
Fixes common syntax mistakes
Views
Code and collapsible tree
Privacy
Parsed in your browser
Use JSON Formatter & Validator Read the guideHow to Fix Invalid JSON: The 8 Most Common Errors
FAQ

Questions about this tool

Something missing? Write to contact@ultratoolsai.com.

What makes JSON invalid?

Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, comments, and missing brackets. The validator shows the exact line and column of the problem.

Can it fix my JSON automatically?

The Repair button fixes common issues such as trailing commas, single quotes, unquoted keys, and comments, then validates the result.

Is there a size limit?

No fixed limit. Files of several megabytes format instantly. Very large documents show a partial tree to stay responsive.

Is my data sent anywhere?

No. Parsing and formatting happen entirely in your browser, which makes it safe for API responses and config files.