DocsQuick Start

Quick Start

Install the package

npm install @json-schema-x-graphql/core

Convert JSON Schema → GraphQL SDL

import { convertJsonSchemaToGraphQL } from "@json-schema-x-graphql/core";
 
const sdl = convertJsonSchemaToGraphQL({
  $schema: "http://json-schema.org/draft-07/schema#",
  title: "Product",
  type: "object",
  properties: {
    id: { type: "string" },
    name: { type: "string" },
    price: { type: "number" },
  },
  required: ["id", "name"],
});
 
console.log(sdl);
// type Product {
//   id: String!
//   name: String!
//   price: Float
// }

Convert GraphQL SDL → JSON Schema

import { convertGraphQLToJsonSchema } from "@json-schema-x-graphql/core";
 
const schema = convertGraphQLToJsonSchema(`
  type Product {
    id: String!
    name: String!
    price: Float
  }
`);

Use the interactive editor

Open the Live Editor → to author schemas visually with real-time bidirectional conversion and Apollo Federation support.

Next steps