Skip to content

ds-forks/xsd2json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XSD To JSON Schema

Transforming XSD files into JSON Schema

Python script that converts XSD files into JSON Schema.

For example, transforming:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="example" type="xs:string" nillable="true" />
</xs:schema>

Into:

{
    "properties": {
        "example": {
            "type": "string"
        }
    },
    "required": [
        "example"
    ],
    "$schema": "http://json-schema.org/schema#"
}

USAGE

CLI

Output JSON schema to stdout.

xsdtojson [PATH TO XSD FILE] --pretty

Output JSON schema to file

xsdtojson [PATH TO XSD FILE] > [PATH TO JSON OUTPUT FILE]

PYTHON

from xsdtojson import xsd_to_json_schema
json_schema = xsd_to_json_schema([PATH TO XSD FILE])

TODO

About

Convert XSD files to JSON Schema

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%