XML to JSON Schema
Infer a JSON Schema (Draft 2020-12) from a sample XML document — useful for validating later JSON conversions.
Drop an XML file
we'll infer a JSON Schema from its structure
If you're converting XML to JSON for an API, you usually want a schema for the JSON shape. Converterzilla's XML to JSON Schema generator infers types from a sample XML document and emits a Draft 2020-12 JSON Schema — ready to use with Ajv, json-schema-validator, or any modern validator.
How to use XML to JSON Schema in your browser
- Drop or paste a sample XML. Use a representative example with all the fields you care about.
- Click Generate. We parse the XML, infer types, and emit a JSON Schema.
- Download .json. Save the schema or copy it into your codebase.
Why use Converterzilla for XML to JSON Schema
Modern Draft 2020-12
The latest JSON Schema spec — fully supported by Ajv 8+ and other modern validators.
Required-field detection
Fields present in the sample become required in the schema. Override after if needed.
Type inference
string / number / integer / boolean / array / object — chosen from the sample data.
Frequently asked questions about XML to JSON Schema
It's a starting point. Single-sample inference can't detect optional vs required perfectly, or unions. Expect to hand-edit after generating.
XSD is for XML; JSON Schema is for JSON. This tool generates JSON Schema for the JSON shape that's equivalent to your XML.
XSD generation is on the roadmap. The current output is JSON Schema only.
Further reading and references
- JSON Schema Specification — the official spec we target (Draft 2020-12)