JSON-RPC Generator Tool

Create valid JSON-RPC requests and responses through an intuitive interface with support for both protocol versions.

On this page

Ready to start?

Try the Generator tool now to create JSON-RPC messages.

Go to Generator

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

Protocol Support

Support for both JSON-RPC 1.0 and 2.0 protocol versions

Message Types

Generation of requests, responses, notifications, and batch operations

Parameter Building

Intuitive interface for building complex parameter structures

Error Templates

Standard error response templates with proper error codes

Validation

Parameter type validation and format checking

Export Options

Copy to clipboard and export to file (JSON) functionality

Usage Guide

Creating a Basic Request

To create a simple JSON-RPC request:

  1. Select "Request" from the message type dropdown
  2. Choose the protocol version (1.0 or 2.0)
  3. Enter a method name (e.g., "subtract")
  4. Add parameters using the parameter builder
  5. Specify an ID value (or generate one automatically)
  6. 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:

  1. Select "Error Response" from the message type dropdown
  2. Choose the protocol version
  3. Select a predefined error code or enter a custom one
  4. Provide an error message
  5. Add additional error data (optional)
  6. Match the ID from the original request
  7. 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:

  1. Select "Batch" from the message type dropdown
  2. Add individual requests/responses to the batch
  3. Reorder batch items as needed
  4. Click "Generate" to create the batch message

Standard Error Codes

The generator includes these standard JSON-RPC 2.0 error codes:

CodeMessageMeaning
-32700Parse errorInvalid JSON was received
-32600Invalid RequestThe JSON sent is not a valid Request object
-32601Method not foundThe method does not exist / is not available
-32602Invalid paramsInvalid method parameter(s)
-32603Internal errorInternal JSON-RPC error
-32000 to -32099Server errorReserved 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