What is JSON?
JSON (JavaScript Object Notation) is a lightweight data interchange format widely used in web APIs, config files, and data exchange. This free online JSON formatter auto-formats your JSON on paste, and supports auto-repair, YAML/CSV/TypeScript conversion, tree view, and JSONPath queries — all in your browser with no ads.
Format
Beautify compressed JSON with proper indentation for better readability.
Validate
Check if your JSON is syntactically correct and find errors.
Minify
Remove whitespace to reduce file size for production use.
Auto-Repair
Automatically fix common JSON errors like trailing commas, single quotes, comments, and unquoted keys.
YAML/CSV Conversion
Convert JSON data to YAML or CSV format for copying or downloading.
TypeScript Generation
Automatically generate TypeScript interfaces by analyzing JSON structure.
How to Use JSON Formatter
- Paste JSON (Auto-Formats!) — Paste valid JSON and it auto-formats instantly — no button needed!
- Auto-Repair or Format — Use 'Auto-Repair' to fix broken JSON errors, or click 'Format (Beautify)' to apply indentation manually.
- View as Tree — Switch between text/tree view modes to visually explore the data structure.
- Switch View Modes — Explore results in YAML, CSV, or TypeScript view modes.
- Copy or Download — Copy or download the result in your preferred format.
Use Cases
API Development & Testing
Prettify REST API responses to quickly understand data structures and debug issues.
Debugging & Validation
Instantly detect JSON syntax errors and pinpoint the exact location of issues.
Config File Editing
Neatly organize and edit configuration files like package.json and tsconfig.json.
Learning & Data Analysis
Visualize complex JSON structures in tree view to understand data models.
Data Conversion
Convert JSON to YAML or CSV for use in other systems or spreadsheets.
TypeScript Development
Auto-generate TypeScript interfaces from API response JSON for type-safe code.
Frequently Asked Questions
What is JSON?
JSON (JavaScript Object Notation) is a lightweight text-based format for storing and transmitting data. It's easy for humans to read and machines to parse, widely used in web APIs and configuration files.
What is a JSON formatter used for?
It's used to prettify compressed JSON for readability or to find and fix JSON syntax errors. Useful for API response analysis, config file editing, and data validation.
What's the difference between JSON and JavaScript objects?
JSON is a string-based data format, while JavaScript objects are a programming language data type. In JSON, keys must be wrapped in double quotes, and functions or undefined cannot be values.
Is there a maximum file size for JSON?
JSON itself has no size limit, but this tool runs in the browser, so it works best with data within a few MB. For very large files, consider using a dedicated editor.
Why use Minify?
Minify removes unnecessary whitespace and line breaks from JSON files to reduce file size. This improves transfer speed and saves storage when deploying API responses or configuration files.
What errors can JSON auto-repair fix?
Auto-repair can fix trailing commas, single quotes, JavaScript comments (// and /* */), and unquoted keys - the most common JSON syntax errors.
Can I convert JSON to TypeScript interfaces?
Yes, the TypeScript view automatically generates interfaces from your JSON data, including support for nested objects, arrays, optional fields, and union types.
Does JSON auto-format when I paste it?
Yes! If you paste valid JSON, it automatically formats it for you — no need to click any button. The formatted result appears instantly in the output panel.
How do I make JSON look pretty / readable?
Paste your JSON into the input field and it will auto-format instantly. You can also click the 'Format' button to apply indentation. Switch to Tree view for a visual, collapsible hierarchy of your data.
Why does a long numeric ID change after formatting?
This tool reads numbers with JavaScript's JSON.parse. Integers with an absolute value above 9007199254740991 may lose precision. For long IDs that do not need arithmetic, send them as double-quoted strings when creating the data. Auto-format on paste has the same limitation, so keep a separate original copy.
Can I use repaired JSON without checking it?
A successful parse does not guarantee that the original values survived. Some string patterns can change, and repair does not infer missing values. Use Format for valid JSON. When repair is needed, keep the original separately and compare the keys and values afterward.
Does this tool support every JSONPath expression?
No. Its custom implementation supports basic property paths, array indexes, and wildcards, not the full JSONPath syntax including filters and recursive descent. Use simple paths such as the array-name example below, and check the result against the original data.
Privacy Notice
This JSON formatter processes all data entirely within your browser. Your JSON data is never sent to any server, and no information is stored or collected. You can safely process sensitive data with complete confidence.
JSON examples with reproducible inputs and outputs
These results were checked against this tool's current processing code, using two-space indentation with key sorting off. Compare formatting, auto-repair, and JSONPath extraction directly.
1. Format an API response for reading
Paste this JSON or run Format (Beautify). Use Text view to inspect the object and array structure.
Input
{"name":"Tani","active":true,"scores":[10,20]}Current tool output
{
"name": "Tani",
"active": true,
"scores": [
10,
20
]
}In this example, the values stay the same while spaces and line breaks are added. However, the tool parses and reserializes the input; it is not an editor that preserves every original text or value. See the large-integer and duplicate-key cases below.
2. Repair input containing a comment and single quotes
This input is not standard JSON. In this example, Auto-Repair removes the comment, quotes the keys, changes string quotes, and removes the trailing comma.
Input
// example
{name:'Tani',active:true,}Current tool output
{
"name": "Tani",
"active": true
}Repair is an aid for some common syntax problems. It cannot fully restore an arbitrary damaged file or determine what its author intended.
3. Extract names from an array
Format the input JSON first, open the query panel with the JSONPath button, and enter the path below. The wildcard selects each item in the users array.
Input
{"users":[{"name":"Tani"},{"name":"Mina"}]}Query path: $.users[*].name
Current tool output
[
"Tani",
"Mina"
]Change the path to $.users[0].name to find only the first name. With one match, this tool displays the value itself rather than an array of matches.
Value loss and repair limits to check before formatting
Valid syntax is not the same as correct data. Keep original copies of important files and check IDs and individual values before saving the result.
Large integers may round during formatting or paste
This number is outside JavaScript's safe-integer range. Its value changes during parsing in the current tool, not because of the indentation setting.
Input
{"id":9007199254740993}Current tool output
{
"id": 9007199254740992
}Exporting the ID as a string from the original system preserves these digits. Converting an already-rounded result to a string later cannot recover the original number.
Duplicate keys in one object keep only the last value
This input parses without an error, but the first role value disappears. RFC 8259 recommends unique object names for interoperability.
Input
{"role":"reader","role":"editor"}Current tool output
{
"role": "editor"
}If both values matter, revise the original structure to use distinct keys or an array. This tool does not issue a separate duplicate-key warning.
Successful repair does not guarantee unchanged strings
This is a counterexample from running Auto-Repair on already-valid JSON. The current repair logic also removes the comma inside the string, changing its value.
Input
{"note":"a,}"}Current tool output
{
"note": "a}"
}Use Format, not Auto-Repair, to indent valid JSON. Repair can also change the input field, so save the original separately before running it and compare string values afterward.
JSONPath scope: use property/index paths such as $.users[0].name and basic wildcards such as $.users[*].name. Filters and recursive descent are not supported. An empty result from a complex path does not establish that the source data is absent.
Verification basis and official references
On September 12, 2026, these inputs and outputs were checked using JSON.parse/JSON.stringify and this tool's repair and JSONPath functions. The official references describe JSON syntax and JavaScript number representation; they do not certify or guarantee this tool's behavior.
Comments & questions