A GraphQL.js library providing JSON scalar types (GraphQLJSON and GraphQLJSONObject) for representing arbitrary JSON values in GraphQL schemas. Current stable version 0.3.2, maintained with low release cadence. Supports GraphQL.js >=0.8.0. Ships TypeScript definitions. Key differentiator: simple, lightweight solution for JSON scalars without additional dependencies. GraphQLJSON handles any JSON-serializable value; GraphQLJSONObject only accepts objects, providing stricter validation. Commonly used in Apollo Server, graphql-tools, and programmatic schema construction.
npm install graphql-type-jsonNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a GraphQL schema with JSON and JSONObject scalar types using @graphql-tools/schema and graphql-type-json.
Use GraphQLJSON for any JSON value; use GraphQLJSONObject for objects only.
Use named import: import { GraphQLJSONObject } from 'graphql-type-json';Ensure graphql >=0.8.0 is installed in your project.
Add JSON: GraphQLJSON and JSONObject: GraphQLJSONObject to your resolvers.
Add `scalar JSON` to your typeDefs and map `JSON: GraphQLJSON` in resolvers.
Use GraphQLJSONObject as a type reference, e.g., `type: GraphQLJSONObject`, not `GraphQLJSONObject()`.