JSON to GraphQL Types
Generate GraphQL schema types (SDL) from a JSON sample. Nested objects become their own types, arrays become lists of the element type, and whole numbers become Int while decimals become Float. Nullability is your choice: most converter tools emit non-null fields by default, and the toggle matches that, or turn it off for the nullable style the GraphQL spec favors.
Result will appear hereHow to use the JSON to GraphQL Types
- Paste a JSON sample in the left pane.
- Decide on nullability: on means every field is non-null, which matches most converter tools.
- Press Generate, then copy the SDL or download it as a .graphql file.
Example
With non-null on, the tags array becomes [String!]!.
{
"name": "json-utils",
"version": "1.0.0",
"private": false,
"tags": ["json", "tools"],
"author": { "name": "Ada", "active": true },
"score": 9.5,
"notes": null
}Frequently asked questions
Non-null on or off?
On matches what most converter tools produce and what the sample literally shows. Off follows the GraphQL convention that fields are nullable unless marked otherwise. Real APIs usually mix the two, so treat the output as a starting point.
What type do null values get?
String, as a placeholder. A sample cannot tell what a null field really holds, so check those fields before using the schema.