xsd-json-converter (xjc)

Use the 'xsd-json-converter' to convert the ISO 20022 XSD files to JSON Schema. This simplifies the process of working with the data programmatically and with other applications.

Features

  • Convert any given XSD to Json schema
  • Supports ISO 20022 XSD
  • Supports Windows, MacOS & Linux

How to consume

npm install -g xsd-json-converter
npm install xsd-json-converter

How to Use (CLI)

                        
                            xjc <source-path> <output-path>
                            
                            //Example
                            xjc xsd/camt.053.001.10.xsd xsd/camt.053.json 
                        
                    
How to Use (JavaScript)
                        
                            const xsd = require('xsd-json-converter').default;

                            xsd.convert('./camt.053.001.10.xsd')
                                .then(output => console.log(output))
                                .catch(error => console.error(error));
                        
                    
How to Use (TypeScript)
                        
                            import xsd from "xsd-json-converter";

                            xsd.convert('./camt.053.001.10.xsd')
                                .then(output => console.log(output))
                                .catch(error => console.error(error));
                        
                    
Generated Schema
                        
                            export interface XsdSchema
                            {
                              namespace:string;
                              SchemaElement:SchemaElement
                            }
                            
                            export interface SchemaElement {
                                id: string;
                                name: string;
                                dataType: string | null;
                                minOccurs: string | null;
                                maxOccurs: string | null;
                                minLength: string | null;
                                maxLength: string| null;
                                pattern: string | null;
                                fractionDigits: string | null;
                                totalDigits: string | null;
                                minInclusive: string | null;
                                maxInclusive: string | null;
                                values: string[] | null;
                                isCurrency: boolean | null;
                                xpath: string | null;
                                elements: Schema[];
                            }
                        
                    
Generated Schema Example
                        
                            {
                                "namespace": "urn:iso:std:iso:20022:tech:xsd:camt.053.001.10",
                                "schemaElement": {
                                    "id": "Document",
                                    "name": "Document",
                                    "dataType": null,
                                    "minOccurs": "1",
                                    "maxOccurs": null,
                                    "minLength": null,
                                    "maxLength": null,
                                    "pattern": null,
                                    "fractionDigits": null,
                                    "totalDigits": null,
                                    "minInclusive": null,
                                    "maxInclusive": null,
                                    "values": null,
                                    "isCurrency": false,
                                    "xpath": "Document",
                                    "elements":[
                                      ...
                                    ]
                                }
                            }