What this tool does
A JSON sample becomes GraphQL SDL types, one per object.
{ "id": 1, "name": "Ada", "tags": ["admin"], "address": { "city": "Paris" } }
type Root {
id: Int!
name: String!
tags: [String!]!
address: Address!
}
type Address {
city: String!
}
[String!]! reads outside in: the list is never null, and no element is null either. Both halves come from the sample, which had a list and had strings in it.
Types only — this is not yet a schema
There is no Query, no Mutation, no directives. A JSON payload says what the data looks like, not which fields a server exposes or what they are called. Add the entry point yourself:
type Query {
root: Root!
}
Until then the file describes types that nothing can be asked for.
What SDL cannot express is named, not faked
nulland unknown values become a customJSONscalar, declared at the top and left for you to implement. SDL has no “anything” type.- A heterogeneous array becomes
[JSON]!for the same reason: a list of mixed shapes is not a GraphQL list type. - An integer outside 32 bits becomes
BigInt, another custom scalar.Intin GraphQL is 32-bit signed, so an eleven-digit identifier is not representable — a server returning it raises at serialization. It used to be typedInt!anyway; that was a real defect, found while writing this page and fixed. - An empty object is refused.
type A {}is not valid SDL — a type must define at least one field — so the conversion stops and names the type rather than handing you a schema no server will parse. This too was found and fixed here.
Names are repaired, and collisions kept apart
GraphQL names allow letters, digits and _ only, and cannot start with a digit. content-type becomes content_type, 2fa becomes _2fa. When two repaired names collide inside a type, the second is suffixed, so nothing is silently merged.
A scalar at the root — 42, "text" — is refused: SDL describes object types, and there is nothing to describe.
Private by design
Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.