I am currently looking for a way to convert a JSON Schema to an XSD or XML schema. I have found nothing on this topic and was hoping maybe someone here knew. I was hoping to do it with the Java APIs.
A possible roundabout way of getting your XSD is to start with a json doc (not the jsonschema) that's pretty complete and conformant to your jsonschema, use any of a multitude of json to xml converters, and convert your xml to xsd (one such tool here).
In the same way that an XML Schema specifies the structure and content of an XML document, a JSON schema specifies how the JSON data in a JSON document is organized. It specifies what data fields are expected and how the values are represented.
To convert an XML Schema (XSD) to a JSON Schema, follow these steps: Select the XSD to JSON Schemaaction from the Tools> JSON Toolsmenu. Step Result:The XSD to JSON Schemadialog box is displayed: Figure1. XSD to JSON Schema Dialog Box In the XSD URLfield, choose or enter the URL of the XML Schema document.
Oxygen XML Developer includes a tool for converting an XML Schema file (XSD) to a JSON Schema file. The XSD to JSON Schema action for invoking the tool can be found in the Tools > JSON Tools menu.
If an extension in XSD defines an element with the same name as an attribute in the base, a property named rest is generated to avoid name conflicts in JSON. If a property of a complex type is a collection property, the schema of the collection items will be wrapped in the JSON array schema.
If an XSD type extends another type, then its schema is combined with the schema of the base type using the allOf keyword. If an extension in XSD defines an element with the same name as an attribute in the base, a property named rest is generated to avoid name conflicts in JSON.
Jsons2xsd converts JSON Schema to XML Schema (XSD) and is Java based.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With