Developer Toolkit

JSON & XML Formatter

The standard tool for cleaning up API responses, config files, and data structures.

Auto-detecting Format

Pro Debugging Tip

If your code fails to format, look for trailing commas in JSON or unclosed tags in XML. JSON is strictly "key-value" pairs and does not support comments, whereas XML requires a single root element to be valid.

Why Minify?

While "prettifying" is for humans, minifying is for machines. Removing whitespace and line breaks reduces file size, leading to faster API response times and lower bandwidth usage in production environments.

Formatting and validating JSON and XML

Minified data is efficient for machines and painful for humans. This formatter detects whether you have pasted JSON or XML, reindents it into a readable hierarchy, and reports the precise location of any syntax error it hits along the way.

Prettify or minify

Prettify adds line breaks and two-space indentation so nesting becomes visible at a glance. This is the mode you want while debugging an API response or reviewing a configuration file.

Minify strips every unnecessary space and newline to produce the smallest valid output. Use it for payloads you are about to send over the wire, or for embedding data in a single-line environment variable.

Reading the error messages

JSON errors report a character position. The reported spot is where parsing became impossible, which is often just after the real mistake: an unclosed bracket several lines earlier will be flagged at the point the parser finally gives up.

The most frequent JSON faults are trailing commas before a closing brace, single quotes where double quotes are required, and unquoted keys. All three are legal JavaScript object syntax but invalid JSON, which is why they slip through so often.

XML errors usually mean an unclosed tag, mismatched nesting, or a bare ampersand. An ampersand in XML must be written as & unless it begins a valid entity reference.

Detection is automatic

Input starting with a brace or bracket is treated as JSON; input starting with an angle bracket is treated as XML.

Comments are not valid JSON

The specification has no comment syntax. Strip them before validating or the parse will fail.

Keys must use double quotes

JSON requires double quotes on every key and string. Single quotes are a JavaScript habit, not valid JSON.

Frequently asked questions

Why is valid-looking JSON being rejected?

Check for a trailing comma before a closing brace or bracket, single quotes instead of double, or an unquoted key. These are valid JavaScript but not valid JSON.

Does formatting change my data?

No. Only whitespace changes. Keys, values, ordering and structure are preserved exactly.

Can it handle JSON Lines?

Not directly. JSON Lines files contain one independent document per line, so paste a single line at a time or wrap the lines in an array first.

Is my data sent to a server?

Formatting is performed on submission to produce the output, and the content is not stored afterwards. For highly sensitive payloads, prefer an editor plugin that works entirely offline.