How to use it
- Paste a sample XML document, or a JSON document. Press Example to try one.
- The XSD appears automatically.
- Read it through, adjust types and limits, then copy or download it.
What it works out
- Elements that repeat get
maxOccurs="unbounded"; elements missing from some places getminOccurs="0". - Attributes found every time are
use="required". - Types are guessed from the values:
xs:integer,xs:decimal,xs:boolean,xs:date,xs:dateTimeorxs:string. - A default namespace becomes the
targetNamespace. - If child elements appear in different orders, they are put in an
xs:allorxs:choiceinstead of a sequence, and the tool says so.
From JSON
JSON has no schema in XSD terms, so the tool first turns the JSON into XML the same way as JSON to XML, then describes that XML. When the JSON has one top-level field, that field becomes the outer element; otherwise Root name is used.
Check the result
The schema is guessed from one sample. A value that happens to be a whole number may need to be a decimal or text, and an element that appears once may be allowed to repeat. Review it against all the data it must accept. Validating documents against an XSD is not included.
Example
Made-up input, and what XSD Generator returns for it. Long text is shortened.
<orders xmlns="urn:example:orders">
<order id="1001" status="open">
<customer>Demo User</customer>
<placed>2026-01-31</placed>
<item sku="A1"><qty>2</qty><price>9.50</price></item>
<item sku="B7"><qty>1</qty><price>3</price></item>
<note>Leave at the door</note>
</order>
<order id="1002">
<customer>Test User</customer>
<placed>2026-02-01</placed>
<item sku="C2"><qty>5</qty><price>1.25</price></item>
</order>
</orders><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:example:orders" xmlns="urn:example:orders">
<xs:element name="orders">
<xs:complexType>
<xs:sequence>
<xs:element name="order" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="customer" type="xs:string"/>
<xs:element name="placed" type="xs:date"/>
<xs:element name="item" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="qty" type="xs:integer"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
<xs:attribute name="sku" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="note" type="xs:string" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:integer" use="required"/>
…Questions
Does it make named types?
No. Types are written inside each element, which is easy to read and to change.
Can I get a sample back from a schema?
Yes, with XSD to sample XML.