1.2.7 • Published 11 months ago

xsd-json-converter v1.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

xsd-json-converter (xjc)

Convert any given XSD To JSON schema

npm NPM npm

Features

  • 🔥 Convert any given XSD to Json schema
  • ⚡️ Supports ISO 20022 XSD

How to Install

  1. Install npm package xsd-json-converter.

Global (For CLI)

    npm install -g xsd-json-converter

Local (For SCRIPT/CLI)

    npm install xsd-json-converter

How to Use

CLI

xjc <source-path> <output-path>

Example

Linux
xjc /mnt/c/source/xsd/camt.053.001.10.xsd /mnt/c/source/xsd/camt.053.json 
Windows
xjc C:/source/xsd/camt.053.001.10.xsd C:/source/xsd/camt.053.json 

Script

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));

TypeScript

import xsd from "xsd-json-converter";


xsd.convert('./camt.053.001.10.xsd')
.then(output => console.log(output))
  .catch(error => console.error(error));

NOTE: For script please install the package locally

Supported OS

  • win-64x
  • osx-64x
  • linux-64x

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;
    minExclusive: string | null;
    maxExclusive: string | null;
    values: string[] | null;
    isCurrency: boolean | null;
    xpath: string | null;
    elements: 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":[
          ...
        ]
    }
}
1.2.7

11 months ago

1.2.6

12 months ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1-beta.3

1 year ago

1.1.1-beta.2

1 year ago

1.1.1-beta.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago