Skip to content
JSON → Formatted JSONDeveloper tools

JSON Formatter

Format, validate and minify JSON: 2 spaces, 4 spaces or tabs, sort keys, see the exact line and column of errors, fix trailing commas and quotes, copy or download.

About this tool

About JSON Formatter

JSON Formatter makes JSON readable and tells you exactly what is wrong when it is not valid. Paste JSON into the box, or press Try an example. If it is valid, you see it formatted straight away, with a green “Valid JSON” label, the number of keys, how deeply it is nested, and the size before and after. Choose the indentation: 2 spaces, 4 spaces or tabs. Tick Sort keys A–Z to order every object’s keys alphabetically, which makes two versions of the same data easy to compare. Press Minify to remove all spaces and line breaks for the smallest possible file, for example before putting JSON into a config value or an API request. If the JSON is not valid, the message shows the line and column of the problem, the line itself and a caret under the spot, along with the browser’s explanation. Many errors come from JavaScript habits that JSON does not allow: trailing commas, single quotes, keys without quotes and comments. Try to fix repairs these automatically and checks the result again; always look at the fixed JSON before using it. Copy the result with one button or download it as a .json file. Full screen gives you more room for large files. Everything runs in your browser, so API responses, tokens and private data never leave your device.

JSON Formatter tool

When to use a JSON formatter

Read it, fix it, ship it

Reading API responses

Turn a one-line response into readable, indented JSON.

ExamplePaste a minified response and see each field on its own line.

Fixing invalid JSON

Find the exact line and column of a syntax error.

Example“line 12, column 5” points at the trailing comma.

Config files

Tidy package.json, tsconfig or app settings.

ExampleChoose 2 spaces to match most JavaScript projects.

Comparing versions

Sort keys so two files line up.

ExampleSort both, then compare them in JSON Diff.

Shrinking payloads

Minify JSON before embedding or sending it.

ExampleA 47-byte formatted object becomes 33 bytes.

Converting from JavaScript

Objects copied from code often have single quotes.

ExampleTry to fix turns {name: 'x',} into valid JSON.

JSON tips

Valid JSON, first time

JSON is stricter than JavaScript

Keys and strings need double quotes; no trailing commas, comments or undefined.

Check fixes before use

Try to fix changes your text. Read the result, especially strings that contained quotes.

Keep secrets private

This tool runs in your browser, but avoid pasting live API keys into any website.

See it as a tree

Explore large JSON as collapsible nodes.

Open JSON Viewer

Compare two JSON files

See exactly what changed between versions.

Open JSON Diff

Generate TypeScript types

Turn a JSON sample into interfaces.

Open JSON to TypeScript
Built & tested by

HemantInsights

Senior Software Engineer · Developer of Toolyconvert

Hemant developed JSON Formatter and tests it on desktop and mobile with real files. He is a senior software engineer from Dehradun, India, building websites since 2014, and designed and developed Toolyconvert end to end.

Last updated 14 November 2026

Answers and guidanceFrequently Asked Questions
How do I format JSON?
Paste it into the box. Valid JSON is formatted straight away; choose 2 spaces, 4 spaces or tabs, then copy or download it.
How do I find the error in my JSON?
The error message shows the line and column, the line itself and a caret under the problem spot.
What does Try to fix change?
It removes comments and trailing commas, changes single quotes to double quotes and puts quotes around bare keys, then checks the result.
What is minified JSON?
JSON with all spaces and line breaks removed. It is smaller but hard to read.
Why sort keys?
Sorted keys make two versions of the same data easy to compare. JSON itself does not care about key order.
Is my JSON sent to a server?
No. Formatting and validation happen in your browser.
Can it handle large files?
Yes, files of several megabytes format in a moment on most devices. Use full screen for more room.
Is it free?
Yes, free with no sign-up.
More tools for your workflowRelated Tools

JSON Validator & Interactive Tree Viewer

Validate JSON syntax with line-by-line error messages and explore data in an interactive collapsible tree view.

JSON Diff

Compare two JSON documents by meaning. Finds nested changes, pairs list items by id or in any order, and makes a JSON Patch.

JSON to TypeScript Converter

Paste JSON and get TypeScript interfaces or types: nested interfaces, optional keys, unions and quoted keys. Updates as you type.

JSON Schema Generator

Make a JSON Schema from sample data. Every item of every array is used, formats are detected, and optional fields are found.

1 / 3
Browse all developer tools

Featured on

Toolyconvert is listed on these product directories and launch platforms.