Member-only story
What is JSON-RPC?
RPC (Remote Procedure Call) and REST (REpresentational State Transfer) each have their benefits.
RPC is fast, while REST is popular but less efficient without batch requests.
JSON-RPC is a convenient and efficient protocol suitable for most projects, especially for web platforms using a microservice approach.
JSON-RPC is powerful and highly extensible, supporting batch requests. This means you can group multiple AJAX requests and send them together to the server.
How to Apply JSON RPC?
It has three components:
- Method: you provide a method name as a string, which is then submitted.
- Parameters: an Array or an Object containing parameter definitions that need to be passed along.
- Id: a number used to match requests with responses. If there is no response, the ID is automatically deleted. Users should expect a confirmed response for every request.
The response has three components:
- Result: containing the data returned from the called method. If there is an error, this part will not be included.
- Error: this part appears if the invocation fails, providing details such as the error message and codes.
- Response ID: this matches…




