JSON-RPC
JSON-RPC is a remote procedure call protocol encoded in JSON, defining uniform JSON structures for requests, responses, and notifications, and it is transport-agnostic.
Purpose
It encodes calls as JSON for lightweight RPC—more compact than XML-RPC/SOAP—and is common over WebSocket and with blockchain nodes.
Mechanism
A request is {jsonrpc, method, params, id}; a response is {jsonrpc, result, id} or {jsonrpc, error, id}; a notification (no response) omits id. Batches are JSON arrays. It is transport-agnostic (HTTP/WebSocket/stdin).
Use cases
- Blockchain node APIs
- WebSocket RPC
- Lightweight service calls