JSON to GraphQL Schema Types
Building a GraphQL API usually starts with defining your schema. If you already have REST API responses in JSON, why write the GraphQL types from scratch? This tool takes your existing JSON data and generates matching GraphQL type definitions — proper field types, nested type references, and array handling included.
It's a great starting point when you're wrapping a REST API with a GraphQL layer. Take the JSON response from an existing endpoint, generate the type, add it to your schema, and write a resolver that calls the REST endpoint. You've got a working GraphQL API over legacy services in minutes.
GraphQL Type System
GraphQL has a stricter type system than JSON. There's no generic "any" type — every field needs a concrete type. This converter maps JSON strings to String, integers to Int, decimals to Float, and booleans to Boolean. Nested objects become separate named types. Arrays become [TypeName].
Schema-First Development
Many GraphQL developers prefer schema-first over code-first. You define your types in SDL (Schema Definition Language), then implement resolvers. This tool helps bootstrap that process — generate the types from your data, refine them (add non-null markers, descriptions, custom scalars), and then build your resolvers around the schema.
Apollo Server and Nexus
The generated SDL works directly with Apollo Server's typeDefs. If you're using Nexus (code-first), you'll need to translate the SDL to Nexus builder calls, but the structure gives you a clear blueprint. For Pothos (formerly GraphQL Nexus), the type hierarchy from the generated SDL maps directly to your builder chain.
From REST to GraphQL Migration
The most practical use case for this tool is incremental REST-to-GraphQL migration. Take each REST endpoint's response, generate GraphQL types, add a resolver that proxies the REST call, and gradually build up your GraphQL schema. Clients can start using GraphQL immediately while the backend is still REST under the hood.
Related JSON Tools
For gRPC services, generate Protobuf message definitions from the same JSON. Need TypeScript resolvers? Use JSON to TypeScript.