REST vs gRPC vs JSON-RPC: A Comprehensive Guide
Three distinct approaches for building APIs that allow different software systems to communicate, each with unique philosophies and use cases.
An architectural style that leverages standard HTTP methods to act on "resources" identified by URLs. Communication is stateless and commonly uses JSON.
GET /users/123
A modern, high-performance RPC framework using Protocol Buffers over HTTP/2, enabling bidirectional streaming and multiplexing.
UserService.GetUser({user_id: 123})
A lightweight RPC protocol using JSON that's transport-agnostic, running over HTTP, WebSockets, or other channels.
{"jsonrpc": "2.0", "method": "getUser", "params": {"userId": 123}, "id": 1}
Feature | REST | gRPC | JSON-RPC |
---|---|---|---|
Data Format | JSON (text), XML | Protocol Buffers (binary) | JSON (text) |
Transport | HTTP/1.1 | HTTP/2 | HTTP, WebSocket, TCP |
Model | Resource/verb mapping | RPC, method calls | RPC, method calls |
Streaming Support | ❌ No | ✅ Full duplex | ⚠️ Via WebSocket |
Typing | Dynamic | Strongly typed (IDL) | Dynamic |
Code Generation | Limited, 3rd party | Native, multi-language | Available but basic |
Readability | ✅ Human-readable | ❌ Binary | ✅ Human-readable |
Browser Support | ✅ Mature, native | ❌ Limited, via proxies | ✅ Mature |
Debugging | ✅ Easy (JSON) | ⚠️ Harder (binary) | ✅ Easy (JSON) |
Performance |
⭐⭐
Moderate
|
⭐⭐⭐
High
|
⭐⭐
Moderate to High
|
Moderate performance, limited by text parsing and HTTP/1.1 overhead. Higher latency at scale.
7-10x faster than REST+JSON. Supports multiplexed connections and streaming.
Slightly faster than REST for batch calls. Lower latency with WebSockets.