JSON to GraphQL Schema
Generate GraphQL type definitions from a JSON example object.
Root Type Name
JSON Input
GraphQL Schema
type RootAddress {
street: String
city: String
zip: String
}
type RootPosts {
id: Int
title: String
published: Boolean
}
type Root {
id: Int
name: String
email: String
active: Boolean
score: Float
tags: [String]
address: RootAddress
posts: [RootPosts]
}Related tools
JSON to TypeScriptCode
Generate TypeScript interfaces or types from JSON input.
JSON to Go StructCode
Generate Go structs from JSON with proper json tags.
JSON to Python DataclassCode
Generate Python dataclass code from JSON with type hints.
JSON to Java POJOCode
Generate Java POJO classes from JSON with getters, setters, and constructors.
JSON to Rust StructCode
Generate Rust structs from JSON with serde derive macros.
JSON to C# ClassesCode
Generate C# classes from JSON with public properties and using statements.
About JSON to GraphQL Schema
Turn a JSON sample into GraphQL Schema Definition Language (SDL) types, mapping JSON fields to GraphQL scalars and nested types. A quick starting point when modelling an API or mock schema from existing data.
How to use
- Paste a JSON object that represents your data.
- Review the generated GraphQL type definitions and nested types.
- Copy the SDL into your schema and refine nullability and custom scalars.
Frequently asked questions
- How are numbers mapped?
- Integers map to Int and decimals to Float; you can adjust these in the generated SDL if your API uses custom scalars.
- Does it create input types?
- It generates object types from the sample; input types and resolvers are left for you to add based on your API design.