Report

Help us improve this tool

JSON To GraphQL

Convert JSON sample data into GraphQL type definitions with real-time browser-side schema generation.

O M T

Generate GraphQL types from JSON payloads

GraphQL APIs describe data with strongly typed schemas. When you only have a JSON response sample from a REST endpoint, log export, or fixture file, writing matching GraphQL types by hand is slow and error-prone. This converter inspects your JSON and emits GraphQL object types you can paste into a schema file or use as a starting point for API design.

What this tool does

Paste JSON in the input panel. The generator walks nested objects and arrays, infers scalar and composite fields, and outputs GraphQL type definitions with nested types for child objects. Arrays of primitives become list scalars, while arrays of objects become lists of generated object types.

Common use cases

  • Prototype GraphQL schemas from existing REST API responses.
  • Document payload shapes discovered during integration testing.
  • Bootstrap schema drafts before refactoring services to GraphQL.
  • Compare inferred GraphQL types against OpenAPI or JSON Schema contracts.

Related tools

Working with TypeScript instead? Try the JSON to TypeScript POJO Generator or JSON Schema to TypeScript. For runtime validation, use the JSON to io-ts Codec Generator or convert GraphQL SDL with the GraphQL to TypeScript tool.

Frequently Asked Questions

Does my JSON leave the browser?

No. Conversion runs entirely in your browser. Your JSON is never uploaded to a server, which makes the tool safe for internal API samples and production-like fixtures.

What GraphQL scalar types are inferred?

The generator maps JSON booleans to Boolean, integers to Int, floating-point numbers to Float, and strings to String. Nested objects become separate GraphQL object types with generated names.

Can I use the output as a production GraphQL schema?

The generated schema is a helpful starting point. You will usually want to rename types, add descriptions, mark nullable fields, and define queries or mutations before deploying to production.

Does the tool support JSON arrays at the root?

Yes. Root arrays are handled by inferring the item shape and wrapping it in a list type when appropriate. For best results, use representative samples that include nested objects you expect in production data.

How is this different from GraphQL to TypeScript tools?

This tool creates GraphQL schema types from JSON samples. GraphQL to TypeScript converters work in the opposite direction, generating TypeScript types from existing GraphQL schema documents.