GraphQL to JSON
Convert a GraphQL query shape into a mock JSON response structure.
Sketch the JSON a GraphQL query will return
A GraphQL query already describes the shape of its answer: every field you select shows up in the response, nested exactly as written. This tool reads that selection structure and produces a matching mock JSON object, so you can see the expected response layout before the backend exists. It is meant for quick sketching, not for exact data.
Generating the skeleton
- Type or paste a query into Input Data. Both the full query form and a bare selection like { user { id name } } are accepted. Sample loads a user with a nested profile.
- Click Process / Generate.
- Read the JSON structure shown in the result panel. A short status line confirms that a mock structure was generated.
- Use Copy or Download to keep it, or Clear to begin another query.
What happens to your query
The leading operation keyword and optional operation name are removed, and the remaining braces are wrapped if needed. A field that opens its own selection set becomes a nested JSON object. A field with no sub-selection becomes a leaf whose value is the placeholder text string. Arguments in parentheses, such as an id filter, are dropped, because they change which record comes back, not the response shape.
Good uses for it
- Drafting a fixture for a front-end component while the API is still being built.
- Writing example responses in API documentation or a design proposal.
- Checking how deep a nested selection goes and whether related fields sit where you expect.
- Creating a starting point for a mock server or a unit test stub, which you then fill with realistic values.
Know the boundaries
Every leaf gets the same string placeholder, because the tool has no access to your schema and cannot know whether a field is an integer, boolean or list. Replace those values manually. Aliases, variables, fragments, directives and inline fragments are not handled by this simple pattern-based conversion, and lists are not shown as arrays even when the real field returns several items. The result is also shown as a formatted text preview rather than being checked by a JSON validator, so run it through a parser after editing. Wrapping in the standard data envelope that GraphQL servers add to responses is likewise left to you. Treat the output as a scaffold that saves typing the nesting.
Related Tools