JSON basics
What is JSON?
JSON (JavaScript Object Notation) is a text format for storing and exchanging structured data. Web applications commonly use it to send data through APIs, save configuration settings, and move information between a browser and a server. It is language-independent, so the same document can be read by many programming languages.
JSON is built from objects and arrays. An object stores named key-value pairs inside braces, while an array stores an ordered list inside square brackets. Values can be strings, numbers, booleans, null, objects, or arrays. Property names and string values must use double quotes.
application/json{
"name": "Daily Free Tools",
"active": true,
"toolCount": 12,
"categories": ["Developer", "Text"],
"owner": null
}{"key": "value"}[1, 2, 3]true or falsenullTool overview
What does a JSON formatter do?
A JSON formatter adds consistent indentation and line breaks so nested data is easier to read. Formatting changes whitespace, not the underlying keys or values. This tool also validates syntax, reports detected issues with a line and column, and lets you inspect the result as text or an expandable tree.
Pretty-prints valid JSON with 2 spaces, 4 spaces, or tabs.
Finds syntax errors and duplicate keys, then marks their line numbers and exact locations.
Creates a reviewable preview after fixing common mistakes such as missing quotes or commas.
Removes unnecessary whitespace to reduce the document size.
Orders object keys alphabetically without reordering array items.
Expands nested objects and arrays and lets you search keys, values, and paths.
Removes one escape layer or converts between readable text and standard Unicode escape sequences.
Many formatters parse numbers through JavaScript, which can round integers larger than 9,007,199,254,740,991 or rewrite values such as 1.50 and 1e3. This formatter preserves the original number tokens during formatting and minification.
Step by step
How to format JSON
- 1Add your JSON
Paste text into the Input editor, open a
.jsonfile, or drag a file onto the workbench. The validator checks the document as you type. - 2Choose an action
Select Format for readable indentation, Minify for compact output, or Repair when the input is invalid.
- 3Review the result
Open any diagnostic to jump to the relevant input. Switch between Text and Tree views to verify nested values, object keys, and array items.
- 4Copy or download
Copy the result, download it as a JSON file, or use Use result to move it back into the Input editor.
The entire process runs locally in your current browser tab. Your document is not uploaded to this site. Avoid pasting secrets on a shared or untrusted computer, and clear the workspace when you finish.
Troubleshooting
Common JSON errors and how to fix them
Single quotes
JSON strings require double quotes. Change {'name': 'Ada'} to {"name": "Ada"}.
Trailing commas
A comma cannot appear after the final property or array item. Change {"a": 1,} to {"a": 1}.
Unquoted property names
Object keys must be strings. Change {name: "Ada"} to {"name": "Ada"}.
Missing separators or brackets
Properties need commas between them, and every opening brace or bracket needs a matching closing character.
Comments
Standard JSON does not allow // or /* */ comments. Remove them or use a format designed for comments, such as JSONC.
Python values
JSON uses lowercase true, false, and null, not Python's True, False, and None.
Repair can correct many of these patterns, including truncated documents and JSONP wrappers. A repair is a best-effort interpretation, not proof that the recovered data matches the author's intent. Always compare the preview with the source before using it in production.
Questions and answers
JSON formatter FAQ
Is this JSON formatter safe for private data?
Formatting, validation, repair, search, and download happen in your browser. The tool does not send your JSON to our server. Browser extensions, shared computers, and clipboard content can still create privacy risks.
Does formatting change JSON data?
Formatting should only change whitespace and indentation. This tool preserves original number tokens. Sorting keys changes object key order, so leave that option off when textual order matters.
Why is my JSON invalid?
Frequent causes are single-quoted strings, trailing commas, unquoted keys, comments, missing commas, and unmatched braces or brackets. Select a diagnostic to jump to its location.
How do I fix invalid JSON?
Use the validator messages and correct the source manually when precision matters. Repair can produce a quick preview, but ambiguous fragments may be interpreted in an unintended way.
What is the difference between format and minify?
Format adds indentation and line breaks for people to read. Minify removes unnecessary whitespace for a smaller document. Both preserve the same values when the source is valid.
Can JSON contain comments?
No. Standard JSON has no comment syntax. JSONC adds comments, but strict parsers and APIs may reject it.
Why do some tools change large JSON numbers?
JavaScript cannot exactly represent every integer above Number.MAX_SAFE_INTEGER. A formatter that parses and serializes those values can silently round them. This tool preserves the original numeric text.
Should JSON use 2 spaces or 4 spaces?
Both are valid. Two spaces keeps files compact; four spaces can make deeply nested data easier to scan. Follow your project convention.
Can I format a JSON file without uploading it?
Yes. Open or drag the file into the workbench. The browser reads it locally, and Download creates the formatted file on your device.
What is the difference between JSON and JSONC?
JSONC is JSON with comments, often used for configuration. It is not standard JSON. Remove comments and unsupported trailing commas before sending it to a strict API or parser.