All Projects → ethlo → jsons2xsd

ethlo / jsons2xsd

Licence: MIT license
Highly configurable converter from JSON-schema to XML-schema (XSD).

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to jsons2xsd

jgeXml
The Just-Good-Enough XML Toolkit
Stars: ✭ 20 (-69.23%)
Mutual labels:  json-schema, xsd, xml-schema
xrechnung-visualization
XSL transformators for web and pdf rendering of German CIUS XRechnung or EN16931-1:2017 [MIRROR OF GitLab]
Stars: ✭ 26 (-60%)
Mutual labels:  xsd, xml-schema
fform
Flexibile and extendable form builder with constructor
Stars: ✭ 26 (-60%)
Mutual labels:  json-schema, jsonschema
xml-lint
A php tool to lint and validate xml files from the commandline.
Stars: ✭ 14 (-78.46%)
Mutual labels:  xsd, xml-schema
Jsonschema
An implementation of the JSON Schema specification for Python
Stars: ✭ 3,474 (+5244.62%)
Mutual labels:  json-schema, jsonschema
Json Node Normalizer
'json-node-normalizer' - NodeJS module that normalize json data types from json schema specifications.
Stars: ✭ 105 (+61.54%)
Mutual labels:  converter, json-schema
xsd-reader
Pure PHP XSD Reader (XML Schema)
Stars: ✭ 45 (-30.77%)
Mutual labels:  xsd, xml-schema
to-json-schema
Converts JS objects to JSON Schema
Stars: ✭ 83 (+27.69%)
Mutual labels:  converter, jsonschema
xslweb
Web application framework for XSLT and XQuery developers
Stars: ✭ 39 (-40%)
Mutual labels:  xsd, xml-schema
typeconv
Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
Stars: ✭ 229 (+252.31%)
Mutual labels:  converter, jsonschema
Minecraft-bedrock-json-schemas
The JSON validation schema files for Minecraft bedrock
Stars: ✭ 17 (-73.85%)
Mutual labels:  json-schema
Create-EXEFromPS1
Takes one PowerShell script and any number of supplementary files or even a directory and creates an exe using Windows's built in iexpress program. The exe will run on any machine with PowerShell 2.0+.
Stars: ✭ 81 (+24.62%)
Mutual labels:  converter
LC2KiCad
A C++ utility that converts EasyEDA (LCEDA) file to KiCad 5 Documents.
Stars: ✭ 103 (+58.46%)
Mutual labels:  converter
osx-callhistory-decryptor
macOS (incl big sur) call history decryptor/converter to CSV format.
Stars: ✭ 19 (-70.77%)
Mutual labels:  converter
tyson
A TypeScript serialization/deserialization library to convert objects to/from JSON
Stars: ✭ 25 (-61.54%)
Mutual labels:  converter
svg2ass
Svg2ass - convert SVG vector graphics to ASS subtitle draw instructions.
Stars: ✭ 22 (-66.15%)
Mutual labels:  converter
unicode-formatter
Convert portions of text to fancy text using unicode fonts for use on Twitter and other sites that don't support rich text
Stars: ✭ 31 (-52.31%)
Mutual labels:  converter
event-logging-schema
Event Logging is an XML Schema for describing the auditable events generated by computer systems, hardware devices and access control systems
Stars: ✭ 21 (-67.69%)
Mutual labels:  xml-schema
express-to-koa
Use express middlewares in Koa2, the one that really works.
Stars: ✭ 18 (-72.31%)
Mutual labels:  converter
xml-maven-plugin
XML Maven Plugin
Stars: ✭ 18 (-72.31%)
Mutual labels:  xml-schema

jsons2xsd

Maven Central License: MIT Coverage Status Codacy Badge Build Status GitHub issues open

JSON-schema to XML schema converter written in Java.

Dependency

<dependency>
  <groupId>com.ethlo.jsons2xsd</groupId>
  <artifactId>jsons2xsd</artifactId>
  <version>2.3.0</version>
</dependency>

Snapshots

<repositories>
  <repository>
    <id>sonatype-nexus-snapshots</id>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  </repository>
</repositories>

Usage

try (final Reader r = ...)
{
  final Config cfg = new Config.Builder()
    .targetNamespace("http://example.com/myschema.xsd")
    .name("array")
    .build();
  final Document doc = Jsons2Xsd.convert(r, cfg);
}

Example input

{
  "type":"array",
  "items":{
    "type":"object",
    "properties":{
      "price":{
        "type":"number",
        "minimum":0
      },
      "name":{
        "type":"string",
        "minLength":5,
        "maxLength":32
      },
      "isExpired":{
        "default":false,
        "type":"boolean"
      },
      "manufactured":{
        "type":"string",
        "format":"date-time"
      }
    },
    "required":[
      "price",
      "name",
      "manufactured"
    ]
  }
}

Example output

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x="http://example.com/myschema.xsd" elementFormDefault="qualified" targetNamespace="http://example.com/myschema.xsd">
  <complexType name="array">
    <sequence>
      <element name="price">
        <simpleType>
          <restriction base="decimal">
            <minInclusive value="0" />
          </restriction>
        </simpleType>
      </element>
      <element name="name">
        <simpleType>
          <restriction base="string">
            <minLength value="5" />
            <maxLength value="32" />
          </restriction>
        </simpleType>
      </element>
      <element minOccurs="0" name="isExpired" type="boolean" />
      <element name="manufactured" type="dateTime" />
    </sequence>
  </complexType>
</schema>

Support for non-standard types and formats

Ignore unknown JSON formats

final Config cfg = new Config.Builder()
    .ignoreUnknownFormats(true)
    ...
    .build();

Register custom JSON formats

final Config cfg = new Config.Builder()
    .customTypeMapping(JsonSimpleType.INTEGER, "int64", XsdSimpleType.LONG)
    .customTypeMapping(JsonSimpleType.INTEGER, "int32", XsdSimpleType.INT)
    .customTypeMapping(JsonSimpleType.STRING, "ext-ref", XsdSimpleType.STRING)
    ...
    .build();

Register non-JSON types

final Config cfg = new Config.Builder()
    .nonJsonTypeMapping("date-time", XsdSimpleType.DATE_TIME)
    .nonJsonTypeMapping("int", XsdSimpleType.INT)
    ...
    .build();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].