Back to results for “JSON”
.NET › gRPC Services

What is gRPC, and how does it differ from a traditional REST/JSON API?

Beginner

Answer

gRPC is a high-performance RPC (Remote Procedure Call) framework built on HTTP/2, using Protocol Buffers (protobuf) as its binary serialization format for both requests and responses, rather than JSON over HTTP/1.1 as typical REST APIs use. This gives gRPC significantly smaller message sizes (binary vs text), lower latency, native support for streaming (client, server, and bidirectional), and strongly-typed contracts generated from a .proto file -- at the cost of being less human-readable and requiring more tooling than plain REST/JSON, and having limited direct browser support without a proxy layer (gRPC-Web).
// order.proto -- defines the contract
service OrderService {
  rpc GetOrder (GetOrderRequest) returns (OrderResponse);
}
message GetOrderRequest { int32 order_id = 1; }
message OrderResponse { int32 id = 1; string status = 2; }
Real-world example A microservices platform uses gRPC for internal service-to-service communication (where performance and strong typing matter most) while still exposing a REST/JSON API at the edge for external, browser-based clients, using each protocol where it's best suited.

Common follow-ups: Why is gRPC less suitable for direct browser consumption without gRPC-Web?;How does protobuf's binary format achieve smaller payloads than JSON?