From JSON to GraphQL API in Seconds
Building a GraphQL API from an existing REST API or database? The hardest part is writing all the type definitions. Paste a sample JSON response and get a complete SDL schema including types, input types, and Query/Mutation boilerplate.
GraphQL Scalar Mapping
string→String- integer →
Int - float →
Float boolean→Boolean- Field named
idor_id→ID null→ nullable (no!modifier)
What Gets Generated
type TypeName { ... }— Query return typeinput TypeNameInput { ... }— Mutation argument typetype Query { get, list }— Sample query resolverstype Mutation { create, update, delete }— Sample mutations
json
// JSON Input
{ "id": "u1", "name": "Alice", "email": "a@example.com", "age": 28 }
// Generated GraphQL SDL
type User {
id: ID!
name: String!
email: String!
age: Int!
}
input UserInput {
id: ID
name: String
email: String
age: Int
}
type Query {
getUser(id: ID!): User
listUsers: [User!]!
}
type Mutation {
createUser(input: UserInput!): User
updateUser(id: ID!, input: UserInput!): User
deleteUser(id: ID!): Boolean
}