Convert JSON to GraphQL Types
Generate GraphQL type definitions from your JSON data. Perfect for building GraphQL APIs.
JSON Input
GraphQL Types
Instant Types
Generate GraphQL definitions instantly
Privacy First
All processing happens locally in your browser
Nested Objects
Automatically handles nested objects and arrays
JSON to GraphQL Schema: Auto-Generating Type Definitions
GraphQL uses a Schema Definition Language (SDL) to define the types, fields, and operations available in an API. When you have a JSON response from a REST API and want to migrate to GraphQL, or when you're designing a new GraphQL API based on an existing data model, generating the GraphQL type definitions from your JSON saves significant boilerplate writing. Each JSON object becomes a GraphQL type with fields corresponding to the JSON keys.
JSON to GraphQL Type Mappings
JSON strings map to GraphQL String; JSON numbers become Int or Float based on whether they have decimal parts; JSON booleans become Boolean; JSON arrays become GraphQL list types ([String], [User], etc.); JSON nested objects become separate named types with a reference. GraphQL's ! non-null marker is added to fields that appear in all sample objects; fields present in only some objects are nullable.
Beyond the Generated Schema
The generated SDL defines the data types (Query type). A complete GraphQL schema also needs: a Query type listing the root queries, Mutation types for write operations, Subscription types for real-time updates, resolver functions that implement each field, and directives for authorization, caching, and deprecation. The generated types are the foundation — you build the rest of the schema on top.
How to Use This Tool
Paste a JSON object or array of objects representing your data model. The tool generates GraphQL type definitions with appropriate scalar types and nested type references. Copy the SDL output to use as the starting point for your GraphQL schema file.