API Design
GraphQL API Response JSON Example
A real-world JSON example of a GraphQL API response — including nested data, pagination with cursors, null errors field, and extensions for request tracing. Follows the GraphQL specification response format.
Field Reference
datarequiredobject | nullThe result of the GraphQL query. null if errors prevented execution.errorsoptionalarray | nullArray of error objects if any field resolution failed. null when successful.extensionsoptionalobjectProtocol extensions: request IDs, tracing, complexity scores.data.user.posts.pageInforequiredobjectRelay-style cursor pagination info for the connection.data.user.posts.pageInfo.hasNextPagerequiredbooleanWhether more items exist after endCursor.data.user.posts.edges[].cursorrequiredstringOpaque cursor for this specific edge — used in after: argument.data.user.posts.edges[].noderequiredobjectThe actual data object for this edge.Variants
With errorsGraphQL partial response — data for resolved fields, errors for failed ones
Common Use Cases
- →Building GraphQL client code that handles both data and errors correctly
- →Mocking a GraphQL server for frontend development without a backend
- →Understanding Relay-spec cursor-based pagination for infinite scroll
- →Writing integration tests that assert on response shape and field values
- →Documenting your GraphQL API with concrete response examples
GraphQLAPIpaginationcursorresponse formatREST alternative
Validate or format this JSON
One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.
Frequently Asked Questions
Related JSON Examples
API DesignREST API ResponseGeneric REST API response wrapper with data payload, status, and pagination meta.API DesignPagination ResponsePaginated list response JSON with offset, cursor, total, and navigation links.API DesignError ResponseREST API error JSON with status code, machine-readable error code, and validation details.