Developers and architectures tend to compare JSON-RPC with GraphQL and gRPC, though a better comparison might be with XML-RPC. However, given the current interest in GraphQL and gRPC, it’s worth taking a moment to contrast these two interoperability frameworks with JSON-RPC.
GraphQL is a query language and server-side runtime technology. Originally developed by Facebook in 2012, GraphQL is used to fetch and transmit data to APIs. GraphQL is known for being easy to learn and easy to use. Developers consider it easy to integrate with a development environment — a big plus in some organizations. It’s comparable to JSON-RPC in this sense. Unlike JSON-RPC, GraphQL makes APIs faster and more flexible. Ultimately, GraphQL is not primarily a vehicle for RPCs.
gRPC is a remote procedure call framework, but it’s different from JSON-RPC on several levels. Known for being very fast and efficient with computing and network resources, gRPC uses a server-side API call to pass the procedure call’s parameters through a protocol buffer. The buffer turns the parameters into compact binaries that save space and bandwidth. It also speeds up the procedure call.
gRPC also uses an HTTP/2 connection to the server. There are several advantages to this approach, as well as limitations. HTTP/2 is great for fast exchanges of messages. It can also multiplex and stream messages, which is amazing for certain high-traffic and complex use cases. However, HTTP/2 is not available for regular web browsers — a major limitation.
JSON-RPC differs from GraphQL and gRPC, but each has its best fit. JSON-RPC remains a viable option for remote procedure calls for many use cases, especially those that favor simplicity and the advantages of the client/server model.