What is json formatter and validator?
JSON is the standard format for data in APIs, config files and web apps. A single missing comma or quote breaks it, and reading minified JSON by eye is hard.
This tool validates the syntax with the same parser that browsers use, then pretty prints it so you can read the structure, or minifies it to save bytes.
How to use the json formatter and validator
- Paste your JSON into the box.
- Choose indentation or tick minify.
- Press Calculate and copy the output.
How the json formatter and validator works
The text is parsed with JSON.parse. If it fails, the parser message is shown. If it succeeds, the object is written back with JSON.stringify using your chosen indentation.
Worked example
Common uses of the json formatter and validator
- Reading an API response that arrives as one long line.
- Finding the missing comma or quote that breaks a config file.
- Minifying JSON before sending it over the network.
- Preparing sample data for documentation.
- Checking a webhook payload during debugging.
Tips and common mistakes
Common errors are trailing commas, single quotes around strings and unquoted keys. JSON allows none of these.
Do not paste secrets or private tokens into online tools unless you trust them. This one works locally in your browser.
Background: what to know before you rely on it
JSON, short for JavaScript Object Notation, was popularized by Douglas Crockford in the early 2000s as a lighter alternative to XML. It is now the default format for web APIs and many config files. It supports objects, arrays, strings, numbers, booleans and null, and nothing else. There are no comments, no trailing commas, no single quotes and no undefined values, which is why hand edited files often fail. Formatting a file does not change its meaning, only its whitespace. Minifying removes whitespace to save bytes, which matters for large payloads but makes reading harder, so keep a formatted copy for people.
Private, free and fast
This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.
Field by field guide
- JSON: Type or paste your text here. Use a new line for each entry where the label says so.
- Indentation: Choose one of: 2 spaces; 4 spaces; Tab.
- Minify instead: Tick to turn this option on.
Change one field at a time to see how the result responds, and use the worked example above to check that you get the same answer.
Valid JSON in practice
JSON is strict. Keys must use double quotes, strings use double quotes, and trailing commas are not allowed. The validator tells you the position of the first error.
Expert tips
- Common errors are trailing commas, single quotes and unquoted keys.
- Comments are not part of JSON. Remove them or use a format that allows them.
- Numbers cannot have leading zeros, and NaN or Infinity are not valid values.
- Use two spaces for indentation to keep files compact but readable.
- Validate API responses before parsing them in code to avoid runtime errors.
Formatting helps people, and minifying helps machines. Keep the readable version in source control.
Frequently asked questions
How do I validate JSON?
Paste it here and press Calculate. Errors are shown with a message.
What is the difference between format and minify?
Format adds indentation for reading. Minify removes whitespace to save space.
Does it send my data anywhere?
No.
Are comments allowed in JSON?
No. Standard JSON does not allow comments.
Related tools
SQL Formatter
Paste your SQL and press Format. Keywords become uppercase, and each clause starts on its own line so...
Developer ToolsBase64 Encoder and Decoder
Base64 turns text or bytes into a safe string of letters and numbers. Choose encode or decode, paste...
Developer ToolsURL Encoder and Decoder
URL encoding replaces unsafe characters with a percent sign and two hex digits so a link works...
Developer ToolsHash Generator
A hash is a fixed length fingerprint of your text. Enter text to get its SHA 1, SHA 256, SHA 384 and SHA...
Developer ToolsRegex Tester
Enter a pattern, flags and test text. The tester lists every match with its position and capture groups...
Developer ToolsCSS Minifier
Paste your CSS and the minifier removes comments and extra whitespace to make the file smaller, with the...
Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.