JSON-RPC


JSON-RPC is a remote procedure call protocol encoded in JSON. It is a very simple protocol, defining only a few data types and commands. JSON-RPC allows for notifications and for multiple calls to be sent to the server which may be answered out of order.

History

Usage

JSON-RPC works by sending a request to a server implementing this protocol. The client in that case is typically software intending to call a single method of a remote system. Multiple input parameters can be passed to the remote method as an array or object, whereas the method itself can return multiple output data as well.
All transfer types are single objects, serialized using JSON. A request is a call to a specific method provided by a remote system. It must contain three certain properties:
The receiver of the request must reply with a valid response to all received requests. A response must contain the properties mentioned below.
Since there are situations where no response is needed or even desired, notifications were introduced. A notification is similar to a request except for the id, which is not needed because no response will be returned. In this case the id property should be omitted or be null.

Examples

In these examples, --> denotes data sent to a service, while <-- denotes data coming from a service. Although <-- is often called a response in client–server computing, depending on the JSON-RPC version it does not necessarily imply an answer to a request.

Version 2.0

Request and response:

-->
<--

Notification :

-->

Version 1.1 (Working Draft)

Request and response:

-->
<--

Version 1.0

Request and response:

-->
<--