JSON Formatter

JSON Formatter & Beautifier

Format, validate, and repair broken JSON β€” fix trailing commas, Python literals, and more.

Indent:

What is a JSON Formatter?

JSON (JavaScript Object Notation) is a lightweight text format for storing and transmitting data. It is widely used in API responses, configuration files, and database outputs. A JSON formatter takes compressed, hard-to-read JSON and adds indentation and line breaks to make it human-readable. Whether you are a developer, data analyst, or QA engineer, this tool helps you work with JSON data more efficiently.

How to Use

  1. Paste your JSON data into the input box on the left.
  2. Click Beautify to format it with proper indentation. Choose between 2 spaces, 4 spaces, or tab indentation.
  3. Click Minify to remove all whitespace and compress the JSON. Useful for reducing payload size in API requests.
  4. Use Validate to check for syntax errors. The error message will tell you exactly what went wrong.
  5. Use Repair JSON to automatically fix broken JSON. It handles missing quotes, bracket mismatches, trailing commas, Python literals (None/True/False), and more.

Features

Beautify

Expands compressed JSON into a readable format with proper indentation. Choose 2 spaces, 4 spaces, or tab indentation. Essential for analyzing API responses and log data.

Minify

Removes all whitespace and line breaks to produce the smallest possible JSON. Ideal for reducing file size and network payload in API requests.

Validate

Instantly checks whether your JSON is syntactically correct. Displays a detailed error message so you can pinpoint the exact location of any issue.

Repair JSON

Attempts to recover broken JSON automatically. Fixes single quotes, unquoted keys, trailing commas, bracket mismatches, Python literals (None, True, False), and JS/CSS comments.

Common JSON Errors

How to Fix Trailing Comma in JSON

Example: {"name":"John",} β€” a comma after the last item. Allowed in JavaScript but invalid in JSON. The repair tool fixes this automatically. Click the example to try it.

How to Fix Single Quotes in JSON

JSON requires double quotes ("). Using single quotes like {'name':'John'} causes a parse error. The repair tool converts them automatically. Click the example to try it.

How to Fix Bracket Mismatch in JSON

Example: {"data":[1,2,3} β€” mismatched opening and closing brackets. The repair tool uses a stack algorithm to find and fix the correct bracket. Click the example to try it.

How to Fix Unquoted Keys in JSON

Example: {name:"John"} β€” keys without quotes. Valid JavaScript object notation but invalid JSON. The repair tool adds the missing quotes. Click the example to try it.

Privacy

All JSON data you enter is processed entirely in your browser. Nothing is sent to a server. You can safely use this tool with API keys, tokens, and any sensitive data.

πŸ’‘ Building test fixtures with JSON? Use the UUID Generator to bulk-generate UUID v4/v7 identifiers (up to 1,000 at once) and paste them directly into your JSON id fields.

JSON Syntax Guide

JSON is built on two structures: objects ({}), which are collections of key-value pairs, and arrays ([]), which are ordered lists of values. Its simplicity and readability make it the standard format for REST APIs, configuration files, and data storage across virtually every programming language.

String "name": "John"

Must be wrapped in double quotes.

Number "age": 30

Supports integers and floating-point numbers.

Boolean "active": true

Must be lowercase true or false.

Null "nickname": null

Represents an empty or missing value.

Object "address": {"city": "Seoul"}

A set of key-value pairs wrapped in curly braces.

Array "scores": [95, 87, 92]

An ordered list of values wrapped in square brackets.

Example

{
  "name": "John",
  "age": 30,
  "active": true,
  "nickname": null,
  "address": {
    "city": "Seoul",
    "zip": "04524"
  },
  "scores": [95, 87, 92]
}