Convert XML Schema to/from JSON Schema

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  User Guide and Reference > Menu Commands > Convert Menu >

Convert XML Schema to/from JSON Schema

If the active document is an XML Schema, this command generates a JSON schema document from the XML schema. If the active document is a JSON schema, the command generates an XML Schema from the JSON schema. The generated document is opened in a new window, and can then be saved to any location. Conversion options are described below. For more information about JSON and JSON editing support in XMLSpy, see the section JSON and JSON Schema.

 

XML Schema to JSON Schema conversion options

When you click the Convert XML Schema to/from JSON Schema command to convert an XML Schema document to a JSON schema, the Convert XML Schema to JSON Schema dialog (screenshot below) appears. Select the JSON Schema version you want and the conversion options, and click OK. A JSON schema will be generated from the XML Schema, and the generated document will be opened in a new window.

JSONConvertXMLSchema2JSON

The top part of the dialog provides information about how certain XML Schema components are converted. The bottom part of the dialog provides the following options:

 

Create a property named "#" in each subschema: If selected, a property with this name is created in each JSON schema definition.
Create pattern properties matching properties prefixed with '?', "@xsi", "@xmlns": Specifies, for each of these prefixes, a pattern property to match properties with names that have these prefixes. For more information about pattern properties, see the section JSON Objects and Properties.
Always create arrays for particles with maxOccurs > 1: In XML Schema, particles are the elements of complex content models. If the number of occurrences is more than one, then the particles are defined as an array in JSON Schema. Otherwise, they are defined as properties of a JSON object.

 

JSON Schema to XML Schema conversion options

When you click the Convert XML Schema to/from JSON Schema command to convert a JSON Schema document to an XML schema, the Convert JSON Schema to XML Schema dialog (screenshot below) appears. Set the conversion options you want, and click OK. An XML schema will be generated from the JSON Schema, and the generated document will be opened in a new window.

JSONConvertJSONSchema2XML

You can select the following options:

 

Whether JSON property names that begin with '@' and '$' are created or not. They would be created, respectively, as attribute nodes and text nodes.
Whether properties named '#' are created, as XML comment nodes, or not.
Whether pattern properties that match properties prefixed with '?', "@xsi", and/or "@xmlns" are ignored or not. If not ignored, then the properties prefixed with '?', "@xsi", and "@xmlns" are converted, respectively, to processing instructions, xsi: prefixed attributes, and xmlns: prefixed attributes.

 


© 2019 Altova GmbH