Vadim Dalecky5 years ago

JSON-RPC Light

JSON-RPC Light is a light-weight variation of JSON-RPC 2.0 protocol. JSON-RPC Light follows the same semantics as JSON-RPC 2.0 and provides all the same functionality, except messages consume less bytes. This is achieved by simply using the first letter of the fields specified in JSON-RPC 2.0 protocol instead of using the full name of the field. Also, "jsonrpc" signature field is not required.

Modifications to JSON-RPC 2.0

The signature field "jsonrpc": "2.0" is not used.

Instead of using full field names specified in JSON-RPC 2.0, only the first letter of each field is used.

  • "i" instead of "id"

  • "m" instead of "method"

  • "p" instead of "params"

  • "r" instead of "result"

  • "e" instead of "error"

The "i" field must be a number. Or the field should not be present, in case of notification message.

Examples

Syntax:

rpc call with positional parameters:

rpc call with named parameters:

a Notification:

rpc call of non-existent method:

rpc call with invalid JSON:

rpc call with invalid Request object:

rpc call Batch, invalid JSON:

rpc call with an empty Array:

rpc call with an invalid Batch (but not empty):

rpc call with invalid Batch:

rpc call Batch:

rpc call Batch (all notifications):