What is json rpc

Last updated: April 1, 2026

Quick Answer: JSON-RPC is a lightweight remote procedure call protocol that uses JSON encoding for requests and responses. It enables client-server communication by allowing one program to call functions on another program over a network.

Key Facts

What is JSON-RPC?

JSON-RPC is a remote procedure call (RPC) protocol that uses JSON (JavaScript Object Notation) for encoding requests and responses. It is a simple, lightweight protocol that allows a client program to make requests to a server program as if calling functions, but over a network connection. JSON-RPC abstracts the complexity of network communication and allows developers to focus on business logic.

How JSON-RPC Works

In JSON-RPC, a client sends a JSON-formatted request containing a method name, parameters, and a request ID. The server receives this request, executes the corresponding method with the provided parameters, and sends back a JSON-formatted response containing the result and the same request ID. This request-response pattern enables reliable communication between distributed systems. The protocol supports various transport mechanisms including HTTP, WebSockets, and TCP.

Request and Response Structure

A JSON-RPC request is a JSON object containing:

The response follows a similar structure, containing the result of the method call or an error object if something went wrong.

Applications and Use Cases

JSON-RPC is extensively used in blockchain and cryptocurrency applications, such as Bitcoin and Ethereum, where it serves as the standard communication protocol between clients and nodes. It is also used in web APIs, microservices architectures, and distributed systems. The protocol's simplicity and language-independence make it popular in cross-platform and polyglot development environments.

Advantages

JSON-RPC offers several advantages over other RPC protocols: it's simpler than SOAP, more human-readable than binary protocols, widely supported across programming languages, and can be used with various transport layers. These characteristics make it an ideal choice for modern distributed applications and APIs.

Related Questions

How is JSON-RPC different from REST?

JSON-RPC is procedure-oriented and calls remote methods, while REST is resource-oriented and uses HTTP verbs. JSON-RPC can use various protocols, while REST specifically uses HTTP.

Is JSON-RPC used in blockchain?

Yes, JSON-RPC is the standard protocol used by blockchain networks like Bitcoin and Ethereum for communication between clients and nodes.

What is an example of a JSON-RPC request?

A typical request includes jsonrpc version, method name, parameters, and id. For example: {"jsonrpc": "2.0", "method": "add", "params": [1, 2], "id": 1}

Sources

  1. JSON-RPC Official SpecificationCC0-1.0
  2. Wikipedia - JSON-RPCCC-BY-SA-4.0