Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>XML/JSON Schema HelperNew to Visual Studio Code? Get it now.
XML/JSON Schema Helper

XML/JSON Schema Helper

Hippo and co

|
2 installs
| (0) | Free
Helper extension to create an XSD schema from an XML example file as well as create a JSON schema based on an XSD schema.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

XML/JSON Schema Helper

A VS Code extension to help you work with XML and schema formats by providing tools to generate XSD schemas from XML examples and convert XSD schemas to JSON schemas.

Features

1. Generate XSD Schema from XML

Automatically generate an XSD (XML Schema Definition) from an XML example file. The extension analyzes the XML structure, including:

  • Elements and their hierarchy
  • Attributes
  • Data types (string, integer, decimal, boolean, date)
  • Cardinality (minOccurs, maxOccurs)

2. Convert XSD to JSON Schema

Convert existing XSD schemas to JSON Schema format (Draft 07), making it easier to validate JSON documents or integrate with JSON-based tools.

Usage

Generate XSD from XML

  1. Open an XML file in VS Code
  2. Open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux)
  3. Type and select: XML: Generate XSD Schema from XML
  4. A new document will open with the generated XSD schema

Example:

Given this XML:

<?xml version="1.0"?>
<person>
  <name>John Doe</name>
  <age>30</age>
  <email>john@example.com</email>
</person>

The extension generates:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           elementFormDefault="qualified">
  <xs:element name="person">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="age" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="email" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <!-- Additional element definitions... -->
</xs:schema>

Convert XSD to JSON Schema

  1. Open an XSD file in VS Code
  2. Open the Command Palette (Cmd+Shift+P on macOS, Ctrl+Shift+P on Windows/Linux)
  3. Type and select: XSD: Convert XSD to JSON Schema
  4. A new JSON document will open with the generated JSON schema

Example:

Given an XSD schema, the extension converts it to JSON Schema format:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "person",
  "properties": {
    "name": {
      "type": "array"
    },
    "age": {
      "type": "array"
    },
    "email": {
      "type": "array"
    }
  }
}

Commands

This extension contributes the following commands:

  • XML: Generate XSD Schema from XML - Generate XSD schema from the active XML document
  • XSD: Convert XSD to JSON Schema - Convert XSD schema to JSON Schema format

Requirements

  • VS Code version 1.80.0 or higher

Installation

From Source (Development)

  1. Clone or download this repository
  2. Navigate to the extension directory
  3. Run npm install to install dependencies
  4. Press F5 to open a new VS Code window with the extension loaded

Manual Installation

  1. Package the extension: vsce package
  2. Install the .vsix file in VS Code: Extensions → Install from VSIX

Known Limitations

  • The XML to XSD generator creates a basic schema structure. Complex XML patterns may require manual refinement.
  • Type inference is based on simple heuristics (e.g., numeric values, booleans, dates).
  • The XSD to JSON Schema converter supports common XSD constructs but may not handle all advanced features.
  • Generated schemas use ref attributes for element references, which may need adjustment for some use cases.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

ISC

Author

Meatyhippo

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft