JSON-RPC Generator Tool
Create valid JSON-RPC requests and responses through an intuitive interface with support for both protocol versions.
On this page
Overview
The JSON-RPC Generator tool helps you create valid JSON-RPC requests and responses through a guided interface. It supports both JSON-RPC 1.0 and 2.0 protocols and can generate single requests, responses, notifications, and batch operations.
Pro Tip: You can save generated messages for later use or export them to integrate with your applications.
Features
Support for both JSON-RPC 1.0 and 2.0 protocol versions
Generation of requests, responses, notifications, and batch operations
Intuitive interface for building complex parameter structures
Standard error response templates with proper error codes
Parameter type validation and format checking
Copy to clipboard and export to file (JSON) functionality
Usage Guide
Creating a Basic Request
To create a simple JSON-RPC request:
- Select "Request" from the message type dropdown
- Choose the protocol version (1.0 or 2.0)
- Enter a method name (e.g., "subtract")
- Add parameters using the parameter builder
- Specify an ID value (or generate one automatically)
- Click "Generate" to create the JSON-RPC request
Example Request
{ "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 }
Parameter Builder
The parameter builder lets you construct complex parameter structures:
- Array parameters: Add multiple values in ordered sequence
- Object parameters: Add named key-value pairs
- Support for nested objects and arrays
- Various data types: string, number, boolean, null, object, array
Creating Error Responses
To create an error response:
- Select "Error Response" from the message type dropdown
- Choose the protocol version
- Select a predefined error code or enter a custom one
- Provide an error message
- Add additional error data (optional)
- Match the ID from the original request
- Click "Generate" to create the error response
Example Error Response
{ "jsonrpc": "2.0", "error": { "code": -32602, "message": "Invalid params", "data": "Parameter 'divisor' cannot be zero" }, "id": 1 }
Batch Operations
To create a batch of requests or responses:
- Select "Batch" from the message type dropdown
- Add individual requests/responses to the batch
- Reorder batch items as needed
- Click "Generate" to create the batch message
Standard Error Codes
The generator includes these standard JSON-RPC 2.0 error codes:
Code | Message | Meaning |
---|---|---|
-32700 | Parse error | Invalid JSON was received |
-32600 | Invalid Request | The JSON sent is not a valid Request object |
-32601 | Method not found | The method does not exist / is not available |
-32602 | Invalid params | Invalid method parameter(s) |
-32603 | Internal error | Internal JSON-RPC error |
-32000 to -32099 | Server error | Reserved for implementation-defined server errors |
API Reference
The generator can also be used programmatically through our API:
Request Format
POST /api/generate Content-Type: application/json { "jsonrpc": "2.0", "method": "generate", "params": { "type": "request", "version": "2.0", "method": "subtract", "params": [42, 23], "id": 1 }, "id": 1 }
Response Format
{ "jsonrpc": "2.0", "result": { "message": { "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 } }, "id": 1 }
Best Practices
Recommended Practices
- Use descriptive method names following a namespace pattern (e.g., "user.create")
- Prefer named parameters (objects) over positional parameters (arrays) for clarity
- Use appropriate data types for parameters
- Generate unique IDs for each request
- Use notifications (requests without IDs) for events that don't require responses
- Group related requests together using batch operations