JSON-RPC 2.0 Builder

Compose JSON-RPC 2.0 requests, notifications and responses.

Open tool

Overview

The JSON-RPC 2.0 builder composes correctly-shaped request, notification, and response objects for the JSON-RPC protocol. Pick a method name, add positional or named parameters, optionally include an ID, and the builder emits the JSON payload that conforms to the spec. Batch requests are supported too.

Developers integrating with Ethereum and other blockchain nodes, embedded engineers writing client code for a JSON-RPC sensor, and API designers prototyping a new method all need a way to build JSON-RPC payloads quickly. Long-tail keywords covered: build JSON-RPC 2.0 request online, JSON-RPC notification vs request, and JSON-RPC batch request example.

How it works

JSON-RPC 2.0 is defined at jsonrpc.org. A request is a JSON object with jsonrpc: "2.0", a method string, optional params (either an array for positional or an object for named), and an id (a string, number, or null). A notification is a request without an id, and the server must not reply to it. A response is jsonrpc: "2.0" plus either result or error and an id that echoes the request.

Batching wraps multiple requests in a JSON array. The server replies with an array of responses in the same order, skipping notifications. Errors use a small set of standard codes (-32700 parse error, -32600 invalid request, -32601 method not found, -32602 invalid params, -32603 internal error) plus a vendor range from -32099 to -32000.

Examples

  • Request with positional params: {"jsonrpc":"2.0","method":"subtract","params":[42,23],"id":1}.
  • Request with named params: {"jsonrpc":"2.0","method":"subtract","params":{"minuend":42,"subtrahend":23},"id":2}.
  • Notification (no reply expected): {"jsonrpc":"2.0","method":"update","params":[1,2,3]}.
  • Error response: {"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":3}.

FAQ

What is the difference between a notification and a regular request?

A notification omits the id field, which signals that the client does not expect a response. The server must not send a reply. Use it for fire-and-forget events.

Can I send positional and named params in the same request?

No. params is either an array (positional) or an object (named) — never both. The server documentation should say which style it expects.

What happens to errors in a batch?

Each element gets its own response object. Some may succeed, some may fail. The HTTP status code itself remains 200 as long as the batch was processed.

Is JSON-RPC bound to HTTP?

No. The spec is transport-agnostic — it runs over HTTP, WebSocket, raw TCP, stdio, and even named pipes. HTTP is just the most common carrier.

Try JSON-RPC 2.0 Builder

An unhandled error has occurred. Reload ×