'xsd-json-converter (xjc)' is a powerful Node library designed to convert ISO 20022 XSD files into JSON Schema. By transforming complex XSD structures into a more accessible JSON format, xjc simplifies programmatic data handling and enhances integration with other applications. This tool is ideal for developers looking to streamline workflows and make working with ISO 20022 data more efficient and flexible.
npm install -g xsd-json-converter
npm install xsd-json-converter
xjc <source-path> <output-path>
//Example
xjc xsd/pacs.008.001.10.xsd xsd/pacs.008.json
const xsd = require('xsd-json-converter').default;
xsd.convert('./pacs.008.001.10.xsd')
.then(output => console.log(output))
.catch(error => console.error(error));
import xsd from "xsd-json-converter";
xsd.convert('./pacs.008.001.10.xsd')
.then(output => console.log(output))
.catch(error => console.error(error));
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[];
}
{
"namespace": "urn:iso:std:iso:20022:tech:xsd:pacs.008.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":[
...
]
}
}