Converting an XML Schema to JSON Schema
XSD and JSON Schema answer the same question for two different formats: what shape must this document take to be acceptable? That shared purpose is why a conversion is possible at all. An xs:element becomes a property, its type becomes a JSON Schema type, an xs:attribute becomes a property alongside the elements, and minOccurs="0" becomes an absence from required.
The output is Draft 2020-12, so you can paste it straight into the JSON Schema validator and check it without a translation step. If you want to check the XSD itself first — or validate an XML document against it — use the XSD validator.
What does not carry across
This is a faithful structural translation, not a proof of equivalence. XSD can express constraints that JSON Schema has no direct equivalent for — substitution groups, some ordering rules, and the parts of the type system that assume an XML infoset. xs:import and xs:include are not resolved, because resolving them would mean fetching another file and nothing here leaves your device; where one appears, the converter says so rather than quietly dropping the types it defines. Read the output before relying on it.
XSD to JSON Schema FAQ
What is the JSON equivalent of an XSD?
JSON Schema. XSD constrains an XML document; JSON Schema constrains a JSON document. Both describe the shape data must take rather than the data itself, so the concepts line up: an xs:element becomes a property, its type becomes a JSON Schema type, and minOccurs="0" becomes an omission from required.
Does my schema get uploaded anywhere?
No. The conversion runs in your browser, in JavaScript, on the text you paste. Your schema is never transmitted, logged or stored, which is what makes this safe for an internal or proprietary schema.
Are xs:import and xs:include resolved?
No, and the converter says so when it sees one. Resolving them means fetching another file, and nothing here leaves your device. Types defined in an imported schema are not present in the output; convert those files separately and combine the results.
Which JSON Schema draft does it produce?
Draft 2020-12. The output can be pasted straight into this site's JSON Schema validator, which accepts Draft 7, 2019-09 and 2020-12, so you can check the result without a translation step.
Is the conversion exact?
It is a faithful structural translation, not a proof of equivalence. XSD can express constraints JSON Schema has no direct equivalent for, such as substitution groups and some ordering rules. Treat the output as a strong starting point and read it before relying on it.