Software Alternatives, Accelerators & Startups

JsonAPI VS graphql.js

Compare JsonAPI VS graphql.js and see what are their differences

JsonAPI logo JsonAPI

Application and Data, Languages & Frameworks, and Query Languages

graphql.js logo graphql.js

A reference implementation of GraphQL for JavaScript - graphql/graphql-js
  • JsonAPI Landing page
    Landing page //
    2022-11-21
  • graphql.js Landing page
    Landing page //
    2023-08-27

JsonAPI features and specs

  • Standardization
    JSON:API provides a standardized format for building APIs, which promotes consistency and interoperability between different APIs.
  • Efficiency
    It supports features like sparse fieldsets, compound documents, and included relationships which help in reducing the amount of data transferred and improving response times.
  • Decoupling
    JSON:API encourages a clear separation between client and server, allowing them to evolve independently as long as they adhere to the specification.
  • Error Handling
    It has a well-defined error format that makes it easier for clients to understand what went wrong and how to fix it.
  • Community and Tooling
    A growing community and increasing tooling support make it easier to implement JSON:API in various server-side and client-side technologies.

Possible disadvantages of JsonAPI

  • Complexity
    The specification can be complex and may introduce a learning curve for developers who are new to it or used to simpler REST approaches.
  • Overhead
    Strict adherence to the JSON:API specification can sometimes introduce additional overhead in terms of implementation effort, especially for small projects.
  • Flexibility
    While the standardization is beneficial, it can reduce flexibility in scenarios where a more customized or optimized solution is needed.
  • Adoption
    Although growing, JSON:API is not as widely adopted as other conventions like simple REST, and thus some developers and projects might resist switching to it.
  • Resource Intensive
    Some features of JSON:API, like relationship links and included resources, can become resource-intensive for the server if not implemented carefully.

graphql.js features and specs

  • Strongly Typed
    GraphQL.js allows for strongly typed schemas, making it easier to perform validation and introspection on your data, ensuring that queries conform to a specific structure before execution.
  • Efficient Data Fetching
    GraphQL.js enables clients to request exactly the data they need which can reduce over-fetching and under-fetching compared to REST APIs.
  • Rich Developer Tooling
    The introspection capabilities in GraphQL.js allow for rich tooling, enabling better development workflows including robust IDE support and tools like GraphiQL.
  • Evolving APIs
    GraphQL.js facilitates evolving APIs without the need for versioning, providing backward compatibility by introducing non-breaking changes.
  • Community Support
    GraphQL.js has a large and active community, providing numerous resources, plugins, and tools that support smooth development processes.

Possible disadvantages of graphql.js

  • Complexity
    Implementing GraphQL.js can add complexity to projects as developers may need to learn new concepts such as schemas, resolvers, and query languages.
  • Overhead
    The flexibility of GraphQL.js can introduce performance overhead, as the server may need to parse and execute more complex and dynamic queries.
  • Cache Invalidation
    Caching strategies for GraphQL.js can be more complex compared to REST, as caching needs to account for the structure and specifics of the queries requested.
  • Over-fetching Risks
    While GraphQL.js mitigates data over-fetching, it can also expose sensitive data if developers are not meticulous in specifying and controlling the schema and access permissions.
  • Debugging Complexity
    Debugging runtime errors in GraphQL.js can sometimes be more difficult, especially with deeply nested queries and complex resolvers.

Category Popularity

0-100% (relative to JsonAPI and graphql.js)
Development
81 81%
19% 19
Project Management
57 57%
43% 43
API Tools
84 84%
16% 16
Developer Tools
100 100%
0% 0

User comments

Share your experience with using JsonAPI and graphql.js. For example, how are they different and which one is better?
Log in or Post with

Social recommendations and mentions

Based on our record, JsonAPI should be more popular than graphql.js. It has been mentiond 49 times since March 2021. We are tracking product recommendations and mentions on various public social media platforms and blogs. They can help you identify which product is more popular and what people think of it.

JsonAPI mentions (49)

  • OSF API: The Complete Guide
    Built on JSON API standards, the OSF API is intuitive for anyone familiar with REST conventions. Once you learn its core patterns, you can quickly expand into project creation, user collaboration, and more—without constantly referencing documentation. The official OSF API docs provide everything needed to get started. - Source: dev.to / 12 days ago
  • Common Mistakes in RESTful API Design
    Following established patterns reduces the learning curve for your API. Adopt conventions from JSON:API or Microsoft API Guidelines to provide consistent experiences. - Source: dev.to / about 1 month ago
  • Starting the Console front-end for Rainbow Platform
    I’ve used both GraphQL and REST in the past. From json:api to Relay, each approach for building APIs has its pros and cons. However, a constant challenge is choosing between code-first and schema-first approaches. - Source: dev.to / 6 months ago
  • REST API: Best practices and design
    There is a group of people who set out to standardize JSON responses into a single response style, either for returning single or multiple resources. You can take their style as a reference when designing their API to ensure uniformity of responses. - Source: dev.to / 12 months ago
  • Path To A Clean(er) React Architecture - Domain Entities & DTOs
    The server seems to be using the popular JSON:API standard which is a great way to build APIs. But should we really use these data structures in the frontend? - Source: dev.to / 11 months ago
View more

graphql.js mentions (8)

  • Diving into Open-Source Development
    To begin, I'm going to start with GraphQL. This repo is a JS-specific implementation for GraphQL, for which projects written in JS/TS can utilize to build an API for their web app. The reason why I chose this project is because I've always been intrigued by how GraphQl challenges the standard way of building an API, a.k.a REST APIs. I have very little knowledge about this project since I've never used it before at... - Source: dev.to / over 1 year ago
  • How to define schema once and have server code and client code typed? [Typescript]
    When I asked this in StackOverflow over a year ago I reached the solution of using graphql + graphql-zeus. Source: almost 2 years ago
  • Apollo federated graph is not presenting its schema to graphiql with fields sorted lexicographically
    GraphiQL (and many other tools) relies on introspection query which AFAIK is not guaranteed to have any specific order (and many libs don't support it). Apollo Server is built on top of graphql-js and it relies on it for this functionality. Source: over 2 years ago
  • How (Not) To Build Your Own GraphQL Server
    Defining your schema and the resolvers simultaneously led to some issues for developers, as it was hard to decouple the schema from the (business) logic in your resolvers. The SDL-first approach introduced this separation of concerns by defining the complete schema before connecting them to the resolvers and making this schema executable. A version of the SDL-first approach was introduced together with GraphQL... - Source: dev.to / over 3 years ago
  • three ways to deploy a serverless graphQL API
    Graphql-yoga is built on other packages that provide functionality required for building a GraphQL server such as web server frameworks like express and apollo-server, GraphQL subscriptions with graphql-subscriptions and subscriptions-transport-ws, GraphQL engine & schema helpers including graphql.js and graphql-tools, and an interactive GraphQL IDE with graphql-playground. - Source: dev.to / over 3 years ago
View more

What are some alternatives?

When comparing JsonAPI and graphql.js, you can also consider the following products

ReqRes - A hosted REST-API ready to respond to your AJAX requests.

Apollo - Apollo is a full project management and contact tracking application.

JSON Placeholder - JSON Placeholder is a modern platform that provides you online REST API, which you can instantly use whenever you need any fake data.

OData - OData, short for Open Data Protocol, is an open protocol to allow the creation and consumption of queryable and interoperable RESTful APIs in a simple and standard way.

Graphene - Query Languages

JSON Server - Get a full fake REST API with zero coding in less than 30 seconds. For front-end developers who need a quick back-end for prototyping and mocking