JSON Formatter & Validator
Beautify, minify and debug JSON in seconds
What Is JSON?
JSON (JavaScript Object Notation) is the most common format for sending data between servers, apps and APIs. It is made of objects (key-value pairs in curly braces), arrays (lists in square brackets), strings, numbers, booleans and null. It is easy for machines to parse, but APIs usually send it minified on a single line, which is hard for people to read.
Key Features
- Live validation: Every keystroke is checked, so you know instantly whether your JSON is valid
- Precise errors: Syntax errors point to the exact line and column
- Format or minify: Pretty print with 2 spaces, 4 spaces or tabs, or compress to a single line
- Sort keys: Order object keys alphabetically at every level, which makes two JSON files easy to compare
- Copy and download: Copy the result or save it as a .json file
- Private: Your JSON never leaves your browser
How to Format JSON Online
Step 1: Paste Your JSON
Paste your JSON into the Input box. The status line below the editor immediately tells you whether it is valid, what type the top-level value is, and how large it is. Click "Sample" if you just want to try the tool.
Step 2: Choose Your Indentation
Pick 2 spaces, 4 spaces or tabs to match your project's style. Tick "Sort keys" if you want object keys in alphabetical order.
Step 3: Format or Minify
Click "Format" for readable, indented output, or "Minify" to remove all whitespace for the smallest possible payload. The result appears in the Output box.
Step 4: Copy or Download
Click "Copy output" to put the result on your clipboard, or "Download" to save it as a .json file. Your input is remembered in your browser, so it is still there if you reload the page.
Common JSON Errors and How to Fix Them
Trailing Commas
JavaScript allows a comma after the last item, but JSON does not.
{"a": 1,} is invalid; remove the final comma.
Single Quotes
JSON strings and keys must use double quotes. Replace
'name' with "name".
Unquoted Keys
Keys must always be quoted strings. {name: "x"} is
valid JavaScript but invalid JSON.
Comments
Standard JSON has no comments. Remove any // or
/* */ lines before parsing.
Unsupported Values
undefined, NaN, Infinity and
functions are not JSON. Use null or a string instead.
Common Use Cases
- Debugging APIs: Make a minified response readable before you inspect it
- Editing config files: Check package.json, tsconfig.json or app settings before you commit
- Comparing data: Sort keys on two payloads so a diff shows only real changes
- Shrinking payloads: Minify JSON before embedding it in a request or a script
Privacy and Security
Many online formatters send your data to a server. This one uses your browser's built-in JSON parser, so tokens, customer records or internal configs you paste stay on your device.
Conclusion
Whether you are reading an API response or hunting down a missing comma, the JSON Formatter & Validator gives you readable output and exact error locations in seconds. Try it at tools.typinks.com/json-formatter.
Got JSON to Clean Up?
Paste it in, click Format, and see exactly what is inside.
Launch JSON Formatter