JSON to GraphQL Converter

Derives a complete GraphQL schema from a JSON object or array, generating type definitions with correctly inferred scalar and list types for every field. Options allow you to also emit input types, a Query type with item and list resolvers, and a Mutation type with create, update, and delete operations, as well as non-null (!) enforcement for common required fields. The schema is generated locally in your browser and can be downloaded as a .graphql file.

Input

JSON

Schema Options

1 root object, 6 properties
Output

GraphQL Schema

What is JSON to GraphQL Generator?

Migrating a REST API to GraphQL, or building a GraphQL wrapper around an existing JSON API, always starts with the same question: what does the schema look like? Rather than staring at a JSON response and transcribing type names by hand, paste the response here and get a complete GraphQL SDL type definition. JSON integers map to Int, floats to Float, strings to String, booleans to Boolean, fields named “id” to the ID scalar. Nested objects produce separate named types; arrays become list types ([T] or [T!]!). Non-null annotations (!) are added for fields that appear as non-null in the sample. Enable “Generate Operations” to produce a sample query and mutation scaffold alongside the types. The output integrates with Apollo Server (typeDefs), Nexus, TypeGraphQL, and GraphQL Code Generator as the schema source for typed client generation. All inference runs locally — no API response data is sent anywhere.

How to Use

  1. 1

    Paste Your JSON Sample

    Paste a JSON object or API response representing the data structure you want to model as GraphQL types. Include nested objects and arrays for complete type generation.

  2. 2

    Configure GraphQL Output

    Set the root type name, choose between type and input type generation, enable non-null (!) annotations for required fields, and select whether to generate query and mutation stubs alongside the types.

  3. 3

    Generate the GraphQL SDL

    Click "Generate GraphQL". JSON field types are mapped to GraphQL scalars (Int, Float, String, Boolean, ID), nested objects produce named types, and arrays produce list types ([T] or [T!]!).

  4. 4

    Copy into Your Schema

    Copy the SDL type definitions into your GraphQL schema file (.graphql or .sdl). Use them as a starting point and add resolvers, directives, and relationships as needed.

Common Use Cases

GraphQL Schema Bootstrapping

Generate GraphQL type definitions from REST API response JSON to bootstrap a GraphQL schema when migrating from REST to GraphQL or building a GraphQL wrapper around existing REST endpoints.

API Documentation Augmentation

Derive GraphQL types from JSON response samples in API docs to complement existing REST documentation with GraphQL schema equivalents for teams planning GraphQL adoption.

Federation Schema Design

Generate base GraphQL entity types from JSON data models when designing a federated GraphQL schema across multiple microservices, using the generated types as a starting point for @key directives.

Client-Side Type Generation Prep

Create GraphQL SDL type definitions from JSON structures to feed into code generation tools like GraphQL Code Generator, producing typed React hooks and Apollo client queries automatically.

Conversion Examples

JSON Object → GraphQL Type Definition

JSON fields become GraphQL scalar fields with inferred types.

Input JSON

{
  "id": 1,
  "name": "Alice",
  "email": "alice@example.com",
  "isPremium": true,
  "score": 98.5
}

Output CSV

type Root {
  id: Int
  name: String
  email: String
  isPremium: Boolean
  score: Float
}

Nested JSON → Nested GraphQL Types

Nested objects generate separate GraphQL types with cross-references.

Input JSON

{
  "user": {"id": 1, "name": "Alice"},
  "orders": [{"id": 101, "total": 49.99}]
}

Output CSV

type User {
  id: Int
  name: String
}

type Order {
  id: Int
  total: Float
}

type Root {
  user: User
  orders: [Order]
}

Frequently Asked Questions