JSON Formatter, Validator, Diff & AI Fix

Format and validate JSON instantly, diff two JSON objects, or paste broken JSON and let AI return the fixed version. Free, no upload.

Indent
Formatted JSON will appear hereโ€ฆ

About This Tool

Format, validate, and diff JSON โ€” all free, all in your browser

Paste any JSON โ€” from an API response, a config file, or a log โ€” and get instant formatting with syntax validation. Errors are caught in real time with the exact parser message.

Switch to JSON Diff mode to compare two JSON objects side-by-side. Added lines appear green, removed lines appear red. Diffchecker charges for this โ€” here it is free.

New: AI Fix. Paste broken JSON โ€” missing commas, single quotes, unquoted keys, trailing commas, JavaScript object literals โ€” and the AI returns valid JSON with the structure preserved. The AI is told not to invent or drop any keys; it only fixes syntax. Powered by Google Gemini, free, no signup.

โœจ

AI Fix Broken JSON

Paste malformed JSON, get valid JSON back. Handles JS literals, single quotes, trailing commas, unquoted keys.

โ‡†

JSON Diff Mode

Paste JSON A and JSON B โ€” added, removed, and unchanged lines highlighted. Free.

โœ“

Real-Time Validation

Errors are shown instantly as you type, with the exact parser message.

๐Ÿ”’

Local by Default

Format, validate, and diff run in your browser. Only AI Fix sends data anywhere.

Quick Start

How to Format or Diff JSON

01

Paste Your JSON

Paste raw, minified, or malformed JSON into the input panel. Validation runs automatically as you type.

02

Choose Indent Size

Select 2-space or 4-space indentation. The output updates instantly.

03

Copy or Minify

Click Copy to grab the formatted output, or Minify to collapse it to a single line for use in code.

04

Or: Compare Two JSONs

Click the JSON Diff tab. Paste JSON A and JSON B โ€” added lines turn green, removed lines turn red, unchanged lines are normal.

Use Cases

When to Use JSON Formatter

Formatting and validating JSON is an everyday task for developers, testers, and anyone working with APIs or data.

๐Ÿ”

Debug API Responses

Paste raw minified JSON from an API response and pretty-print it to find issues quickly.

โœ…

Validate JSON Syntax

Check whether a JSON string is valid before using it in a configuration file or codebase.

๐Ÿ“ฆ

Minify for Production

Minify a formatted JSON file to reduce payload size before deploying to a production API.

๐Ÿ“‹

Config File Editing

Pretty-print a minified config file so you can read and edit it comfortably before re-minifying.

๐Ÿงช

Mock Data Inspection

Format JSON mock data files to verify structure and spot missing or mistyped keys.

๐Ÿ“Š

Data Analysis Prep

Format raw JSON data exports from databases or tools before parsing or analysing them.

๐Ÿ› ๏ธ

Fix Hand-Typed JSON with AI

Convert JavaScript object literal syntax (unquoted keys, single quotes, trailing commas) into valid JSON with one AI Fix click โ€” useful when copying snippets from code into config files.

FAQ

Frequently Asked Questions

Click the AI Fix tab and paste broken JSON. The tool first tries to parse it locally โ€” if your JSON is already valid, no AI call is needed and you just get a reformatted version. If parsing fails, the broken JSON plus the parser's error message is sent to Google Gemini, which returns a corrected version. The tool then validates the AI's output before showing it to you, so the result is guaranteed to be valid JSON. Handles missing commas, single-quoted strings, unquoted keys, trailing commas, and JavaScript object literal syntax.

No. The AI is prompted with explicit rules: preserve every key and value exactly, do not invent or drop fields, do not rename keys, do not change string values even if they look like typos. Only syntax issues are fixed. You can verify by comparing the output to the input โ€” keys and values are identical, only the punctuation and quotes change.

Yes. Click the JSON Diff tab. Paste JSON A in the left panel and JSON B in the right panel. Added lines are highlighted green with a + marker, removed lines are red with a โˆ’ marker, and unchanged lines are shown normally. The summary bar counts added, removed, and equal lines.

Both JSON inputs are parsed and normalized to 2-space indent before comparison. This means formatting differences alone don't produce false diffs. The comparison uses the LCS (Longest Common Subsequence) algorithm to find the minimal set of changes โ€” the same approach used by git diff.

Format, validate, minify, and diff run entirely in your browser โ€” nothing is uploaded for those features. The AI Fix tab is the one exception: when you click Fix Broken JSON, the input is sent to Google Gemini for processing. Avoid pasting confidential JSON (API keys, secrets, customer data) into the AI Fix tab. Free, per-IP rate limit is 10 requests per minute.

Double-quoted keys and strings, no trailing commas, no comments, correct nesting of {} and []. The validator shows the exact error if something is wrong.

Format adds indentation for readability. Minify removes all whitespace โ€” useful for APIs and config files.

Common causes: trailing commas, single-quoted strings, unquoted keys, or missing brackets. The error message will tell you exactly what went wrong.

Related Tools