How are XML attributes represented in JSON Schema?
XML attributes are represented as object properties whose keys are prefixed with @_ — the same convention popularised by fast-xml-parser. So <book id="bk101"> becomes a JSON Schema property named "@_id". This avoids name collisions when an attribute shares a name with a child element (e.g. an "id" attribute alongside an <id> sub-element).
Which JSON Schema draft does the output target?
Draft 2020-12 — the current published draft on json-schema.org. The $schema URI is set to https://json-schema.org/draft/2020-12/schema. The schema is forward-compatible with most validators (Ajv, Hyperjump, networknt) running 2020-12 strict mode. Downgrading to draft-07 is a one-line change to the $schema URI.
What about CDATA sections?
CDATA blocks are treated as plain text content — the DOMParser strips the CDATA wrapper and returns the inner text. The inferred property carries type "string" with no special marker. If you need to preserve the CDATA boundary in your final JSON document, post-process the schema to add a custom keyword like "x-cdata: true" on the affected text nodes.
How are repeated elements typed?
Repeated child elements (e.g. multiple <tag> inside <tags>) become a JSON Schema array — { "type": "array", "items": { ... } } — where the items schema is inferred from the first occurrence. If your real data has heterogeneous shapes across instances, broaden items to oneOf or use Spectrum / quicktype to unify them.
Why @_ as the attribute prefix instead of @?
A leading @ on a JSON property is technically valid, but most JSONPath libraries reserve @ for the current-node selector and many serializers strip it as JSON-LD context. The @_ convention from fast-xml-parser is widely interoperable, plays nicely with TypeScript identifiers when you bracket-access them, and survives every JSON validator we tested.
Does the output validate the source XML literally, or the JSON form of it?
It validates the JSON form. The schema describes the JSON tree you would get after parsing the XML with fast-xml-parser (or a similar XML-to-JSON converter using @_ for attributes). To validate raw XML, use an XSD instead — convert XML to XSD with a tool like XmlGrid or Trang, then ingest the XSD into your XML validator.
Is the XML I paste sent to your servers?
No. XML is parsed by the browser DOMParser and the JSON Schema is generated entirely in JavaScript on your machine. Open DevTools → Network and you will see no requests when you click Convert. Safe for SOAP responses and configuration files containing API keys or credentials.
Can I use this schema in OpenAPI?
Almost directly. OpenAPI 3.1 fully aligns with JSON Schema 2020-12, so you can paste the schema body under components/schemas with no changes. For OpenAPI 3.0 (a frozen subset of an older draft), drop $schema, replace tuple validation, and use nullable: true instead of "type": ["string", "null"].