Use JSON-RPC Tester

Enter your data below to use the JSON-RPC Tester

📌 Try these examples:
RESULT

Last updated

JSON-RPC Tester Examples

The JSON-RPC Tester lets you send JSON-RPC requests and inspect responses without writing code. Below are examples covering JSON-RPC 2.0 requests, batch calls, and Ethereum API testing.

JSON-RPC 2.0 Request Format

// Standard JSON-RPC 2.0 request structure:
{
  "jsonrpc": "2.0",
  "method": "methodName",
  "params": [...],   // or {} for named params
  "id": 1
}

// Standard response (success):
{
  "jsonrpc": "2.0",
  "result": ...,
  "id": 1
}

// Standard response (error):
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}

Example: Batch Request

// Batch request (array of requests):
[
  { "jsonrpc": "2.0", "method": "add",      "params": [1, 2],    "id": 1 },
  { "jsonrpc": "2.0", "method": "subtract", "params": [10, 3],   "id": 2 },
  { "jsonrpc": "2.0", "method": "multiply", "params": [4, 5],    "id": 3 }
]

// Batch response (results in any order, matched by id):
[
  { "jsonrpc": "2.0", "result": 3,  "id": 1 },
  { "jsonrpc": "2.0", "result": 7,  "id": 2 },
  { "jsonrpc": "2.0", "result": 20, "id": 3 }
]

Example: Notification (No Response Expected)

// Notification — no "id" field means no response expected:
{
  "jsonrpc": "2.0",
  "method": "logEvent",
  "params": {
    "event": "user_login",
    "userId": 42,
    "timestamp": "2024-01-15T14:30:00Z"
  }
}

// Server processes the notification but returns no response.
// Tester shows: "Notification sent — no response expected"

Example: Ethereum JSON-RPC

// Endpoint: https://mainnet.infura.io/v3/YOUR_PROJECT_ID

// Get ETH balance:
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "latest"],
  "id": 1
}

// Response:
{
  "jsonrpc": "2.0",
  "result": "0x1bc16d674ec80000",  // 2 ETH in wei (hex)
  "id": 1
}
// Convert: 0x1bc16d674ec80000 = 2,000,000,000,000,000,000 wei = 2 ETH

// Get latest block number:
{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}

// Response:
{
  "jsonrpc": "2.0",
  "result": "0x12a05f2",  // block number in hex
  "id": 1
}
// Convert: 0x12a05f2 = 19530226

// Get transaction count (nonce):
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "latest"],
  "id": 1
}

Example: Language Server Protocol (LSP)

// LSP uses JSON-RPC for editor-server communication

// Initialize request:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "processId": 12345,
    "rootUri": "file:///workspace",
    "capabilities": {}
  }
}

// Hover request (get type info at cursor):
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "textDocument/hover",
  "params": {
    "textDocument": { "uri": "file:///workspace/main.ts" },
    "position": { "line": 10, "character": 15 }
  }
}

// Response:
{
  "jsonrpc": "2.0",
  "result": {
    "contents": {
      "kind": "markdown",
      "value": "```typescript\nconst myVar: string\n```"
    }
  },
  "id": 2
}

Error Code Reference

Standard JSON-RPC error codes:

Code      Message                 Meaning
-32700    Parse error             Invalid JSON received
-32600    Invalid Request         Not a valid JSON-RPC request
-32601    Method not found        Method does not exist
-32602    Invalid params          Invalid method parameters
-32603    Internal error          Internal JSON-RPC error
-32000    to -32099               Server-defined errors

// Example error response:
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found",
    "data": "The method 'getUser' is not registered"
  },
  "id": 1
}
// After testing in the tester, get equivalent code:

// JavaScript (fetch):
const response = await fetch('https://api.example.com/rpc', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'getUser',
    params: { id: 42 },
    id: 1
  })
});
const data = await response.json();

// Python (requests):
import requests
response = requests.post('https://api.example.com/rpc', json={
    'jsonrpc': '2.0',
    'method': 'getUser',
    'params': {'id': 42},
    'id': 1
})
data = response.json()

// curl:
curl -X POST https://api.example.com/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"getUser","params":{"id":42},"id":1}'

Enter your JSON-RPC endpoint URL, select the method, configure parameters, and send the request to see the response. Use batch mode to test multiple methods in a single call.

Example: Simple Method Call

// Request:
{
  "jsonrpc": "2.0",
  "method": "add",
  "params": [3, 7],
  "id": 1
}

// Response:
{
  "jsonrpc": "2.0",
  "result": 10,
  "id": 1
}

// With named parameters:
{
  "jsonrpc": "2.0",
  "method": "add",
  "params": { "a": 3, "b": 7 },
  "id": 1
}

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! JSON-RPC Tester is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.