JSON Formatter & Validator
Prettify, validate, and minify JSON data instantly in your browser.
About this tool
JSON (JavaScript Object Notation) is the default data format of web APIs, configuration files and log pipelines. It is easy for machines to read, but API responses usually arrive minified on a single line, and a single missing comma makes the whole document unreadable to a parser. This formatter turns compact JSON into an indented, readable document, tells you exactly where it is broken, and converts it back to a compact form when you need to ship it.
Everything runs in your browser with the built-in JSON parser, so you can safely paste production payloads, tokens or customer data: nothing is uploaded, and the page keeps working offline once loaded.
How to use JSON Formatter & Validator
- Paste JSON into the left panel, or use Open File to load a .json file from your computer. The result updates as you type.
- Choose Format for readable output (2 spaces, 4 spaces or tabs) or Minify to remove all whitespace. Turn on Sort keys to order object keys alphabetically, which makes two documents much easier to compare.
- If the input is invalid, read the error line: it shows the line and column and points at the character where parsing stopped. Click Repair JSON to fix common problems automatically.
- Switch the result to Tree view to fold large objects; click any key to get its path (for example $.store.inventory[0].isbn) for use in code or jq-style queries.
- Copy the result or download it as a file.
Examples
Prettify a minified API response
{"id":42,"user":{"name":"Ana","roles":["admin","dev"]},"active":true} {
"id": 42,
"user": {
"name": "Ana",
"roles": [
"admin",
"dev"
]
},
"active": true
} Repair a JavaScript object literal
{
// copied from code
name: 'Ana',
tags: ['a', 'b',],
} {
"name": "Ana",
"tags": [
"a",
"b"
]
} Repair quotes unquoted keys, converts single quotes, and removes comments and trailing commas.
Escape JSON to embed it in a string
{"msg": "hi"} {\"msg\": \"hi\"} Useful when a JSON document must be stored inside another JSON string, an environment variable or a SQL literal.
The most common JSON syntax errors
- Trailing comma after the last item: [1, 2, 3,] is valid JavaScript but invalid JSON.
- Single quotes: JSON strings and keys must use double quotes ("name"), never 'name'.
- Unquoted keys: {name: "Ana"} must be written {"name": "Ana"}.
- Comments: JSON has no // or /* */ comments. Formats such as JSON5 or JSONC allow them, standard parsers do not.
- Special values: undefined, NaN and Infinity do not exist in JSON; use null or a string instead.
- Unescaped control characters: a raw tab or newline inside a string must be written as \t or \n.
- Large numbers: integers beyond 2^53 (such as 64-bit database IDs) lose precision in JavaScript. Send them as strings if exact digits matter.
Format vs. minify: which should you use?
Formatted JSON is for people: code reviews, documentation, debugging and config files that live in version control. Minified JSON is for machines: it removes every byte of whitespace, which reduces payload size by 10–30% for typical API responses before compression.
Sorting keys does not change the meaning of a JSON object, because object keys are unordered by specification. It is a handy trick before running a diff on two responses: with keys sorted, only real value changes show up.
Frequently asked questions
Everything you need to know about this tool and data security.
Why does my JSON fail here but work in my JavaScript code?
JavaScript object literals are more permissive than JSON: they allow single quotes, unquoted keys, comments and trailing commas. JSON.parse and every API client follow the strict JSON standard (RFC 8259). Use Repair JSON to convert a literal into strict JSON.
How large a file can I format?
Files of tens of megabytes work in modern browsers; the limit is your device memory. For very large files the result updates after you pause typing, and the tree view shows the first 2,000 children of each node to stay responsive.
Does sorting keys or formatting change my data?
No. Values, types and array order are preserved exactly. Only whitespace (and, with Sort keys, the order of object keys) changes. Numbers are re-printed by the JavaScript engine, so 1.0 becomes 1 and 1e3 becomes 1000; both forms mean the same value.
What is a JSON path?
A JSON path such as $.store.inventory[0].isbn describes how to reach one value: $ is the root, .name selects a key and [0] selects an array item. Click a key in Tree view to copy its path.
Is my data safe when using this tool?
Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.
Related Tools
Featured Projects tech-fun.net
Explore more AI & productivity tools
Nihongo GameBox
Master Japanese typing, Kana, and JLPT N5–N1 vocabulary through interactive retro arcade games.
ResumeGPT
Tailors CVs and cover letters to every job opportunity with a multi-agent LLM pipeline, job tracking, and scheduled discovery.
CollectMind
Turns your bookmarks into a searchable AI knowledge base — entirely on-device, powered by Chrome's built-in Gemini Nano.