can anybody suggest how to convert XSD schema to JSON schema using Java?
I have tried so many ways, almost all the ways generating class files using com.fasterxml.jackson libraries and then converting it to JSON which is not possible in my case.
here are the links I have tried
https://dzone.com/articles/generating-json-schema-xsd
http://marxsoftware.blogspot.in/2015/06/json-schema-xsd-jaxb-jackson.html
Thanks in Advance.
Plugin for converting an XML Schema (XSD) file to a JSON Schema file. Once installed, go to Tools -> XML Actions, or right-click on an XML Schema file from Project view, and select "Convert XSD to JSON Schema".
xsd is the XML schema you will use as input to the JAXB binding compiler, and from which schema-derived JAXB Java classes will be generated. For the Customize Inline and Datatype Converter examples, this file contains inline binding customizations.
Follow below steps to directly transform XSD into JSON Schema using Jsonix library
Download jsonix schema compiler from here
The downloaded jar name would be something like below based on downloaded versionjsonix-schema-compiler-full-2.3.9.jar
Open command prompt or linux shell and navigate to the above jar directory.
Execute below command from this directoryjava -jar jsonix-schema-compiler-full-2.3.9.jar -generateJsonSchema -p FOOD schemas/food.xsd
Note: in above command schemas/food.xsd
is the relative path of XSD schema file
Above step will generate two files in the current directory
a. schema file (FOOD.jsonschema)
b. mapping file (FOOD.js)
The schema file with .jsonschema extenstion is the desired equivalent JSON Schema.
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