JSON / XML Validator
Validate and format JSON and XML right in your browser. No data sent to any server.
Paste some text and press “Validate & format”.
What the JSON / XML validator does
JSON (JavaScript Object Notation) and XML (eXtensible Markup Language) are the two most common formats for exchanging structured data between systems: web APIs, config files, feeds, documents. Both are human-readable text, but a single stray comma, an unclosed bracket, or an unbalanced tag is enough to make the whole document invalid — and in production that error can be hard to spot by eye. This tool instantly checks whether what you paste is well-formed and, if it is, hands it back to you neatly indented.
For JSON, validation follows the ECMA-404 standard: the document is parsed with the browser's native parser and, on a syntax error, the tool points you to the approximate location with a line and column so you know where to look. When the JSON is valid it is reformatted with two-space indentation, laying objects and arrays out across multiple lines to make them easy to read and diff.
For XML, the tool checks that the document is well-formed: tags opened and closed correctly, proper nesting, quoted attributes, a single root element. It does not validate against a schema (XSD or DTD): it checks the shape, not the rules of a specific vocabulary. If the XML is well-formed it is re-indented with two spaces per level. All processing happens in your browser via native APIs: no document is ever sent to a server, so you can paste sensitive data without worry.
The most common use case is debugging: you paste an API response or a config file you can't parse at a glance, and in an instant you know whether the problem is a syntax error (and where) or the document is simply minified and just needs formatting. It's also useful for comparing two JSON payloads — formatting them the same way makes differences easy to spot with a plain text diff — or for preparing sample data to paste into an issue or support request without hand-guessing the indentation.
The most common JSON mistakes are a trailing comma after the last item (not allowed, unlike JavaScript), unquoted or single-quoted keys, and comments (JSON has none). Typical XML mistakes are unclosed tags, unescaped special characters in text content (for example & must be written as &), and more than one root element. It's also worth remembering that "well-formed" does not mean "valid against a schema": an XML document can be syntactically correct while still not matching the structure expected by a specific XSD or DTD — that level of checking needs a dedicated schema-validation tool.
Frequently asked questions
- Is my data sent to a server?
- No. Validation and formatting happen entirely in your browser via the native JSON and DOMParser APIs. No document is transmitted or stored — you can safely paste sensitive data.
- Does the tool validate XML against an XSD or DTD schema?
- No. It checks that the XML is well-formed — balanced tags, correct nesting, a single root element — but does not check conformance to a specific schema. It is the right check for catching syntax errors in most use cases.
- Why does my JSON report a comma error?
- JSON does not allow trailing commas after the last item of an object or array, unlike JavaScript. Comments and single quotes are not allowed either: the standard requires double quotes for keys and strings.