JSON-RPC 2.0 Fundamentals

JSON-RPC 2.0 is a small protocol for representing remote procedure calls (RPC) as JSON documents. A remote procedure call simply means invoking an operation on another application or service in a similar way to calling a local method. JSON-RPC does not define the business model of the application. It only defines the envelope used to call a method and receive a result or error.

JSON-RPC 2.0 defines only a small number of standard fields used by requests and responses:

RPC Request Example

{
  "jsonrpc": "2.0",
  "method": "Shipment.Search",
  "params": {
        "trackingNumber": "TRK-123"
  },
  "id": "2"
}

Successful Response Example

{
  "jsonrpc": "2.0",
  "result": {
        "trackingNumber": "TRK-123",
        "status": "In Transit"
  },
  "id": "2"
}

Error Response Example

{
  "jsonrpc": "2.0",
  "error": {
        "code": -32601,
        "message": "Method not found"
  },
  "id": "2"
}

The important design lesson is separation of concerns. JSON-RPC describes how the call is packaged. Your application decides what the method names mean and what the parameter and result payloads contain (highlighted in gray color in the examples above).

Standard Versus Application-Specific Fields

Applications may introduce additional custom fields when necessary, for example for tracing, diagnostics, routing, or multi-tenant support, but those fields are often discouraged unless truly needed because:

 

Table of Content Operation-Oriented APIs and AI Tools Previous: From REST APIs to Operation-Oriented APIs Next: Single Endpoint Architecture

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.