# Jayson: JSON-RPC for node.js without the framework

> Jayson is a JavaScript library that implements JSON-RPC 2.0 and 1.0 as both client and server for node.js. It gives you method tables, HTTP, TCP and WebSocket transports, and a CLI, under an MIT licence.

**tedeh/jayson** — Jayson is a simple but featureful JSON-RPC 2.0/1.0 client and server for node.js

- Repository: https://github.com/tedeh/jayson
- Website: https://jayson.tedeh.net
- Stars: 727 · Forks: 115
- Language: JavaScript
- License: MIT
- Published: 2026-10-21 · Updated: 2026-10-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/tedeh-jayson

## The gap Jayson fills inside a node.js service

Jayson targets a narrow, unglamorous job: speaking JSON-RPC in JavaScript. The README describes it as a compliant server and client for node.js that aims to be as simple as possible to use, and the project description calls it a simple but featureful JSON-RPC 2.0/1.0 client and server. In practice this is the part of an application where an internal service, a desktop companion or a script has to call a method on another process and expects a structured request, result and error object rather than a hand rolled JSON payload. The alternative is usually one of two things: write the envelope handling, id matching, error mapping and batch logic yourself, or adopt a web framework and wire a JSON-RPC layer on top of it. Jayson takes the middle path. It is a library rather than a server framework, so it leaves your routing, your process model and your deployment story alone.

## Method tables, several interfaces, and a relay mode

The feature list is where Jayson earns its keep. A server can listen to several interfaces at the same time, and it supports both HTTP and TCP client and server connections. On top of that sit server side method routing, where a method name is mapped to a handler, and relaying of requests to other servers, which turns a Jayson server into a forwarder in front of other JSON-RPC endpoints. Method definitions are separate from the server object itself, so handlers can be wrapped and tested away from the transport. The repository ships a matching examples directory with folders for method_routing, method_wrapping, many_interfaces, relay, cors, context, notifications, batches and named_parameters, which is a fair indication of the surface area. Websocket client and server support arrived in 3.6.4, so websockets are a peer transport rather than an afterthought.

## The 5.0.0 delimiter rule breaks naive TCP clients

The most important line in the changelog is a removal rather than an addition. Version 5.0.0 dropped the stream-json dependency, and with it the ability to read concatenated JSON without delimiters. The changelog states that TCP and TLS messages must now end with the configured delimiter, newline by default, and that this probably breaks backwards compatibility. The practical effect is that a client writing one JSON object after another with no separator will no longer be parsed correctly, and the project points readers to its recommended use section if they require advanced parsing in TCP or TLS streams. The same release removed the uuid package in favour of the native crypto implementation, with a note that a browser lacking it must supply its own generator. Earlier milestones cut deeper still: 4.0.0 removed lodash to halve bundle size, and 3.0.0 removed the collect option entirely, with JSON-RPC params now always arriving as the first argument.

## Installing Jayson and running your first call

Installation is a single npm step. The README tells you to install the latest version of jayson from npm by executing the command below, and the requirements section notes that Jayson has no special dependencies that a plain npm install or yarn install cannot resolve. A global install puts the command line client on your PATH, which is what you want if you plan to call JSON-RPC endpoints from a shell.

```bash
npm install jayson
```

The README's own example server defines a single add method whose handler receives the params array and a callback, then starts an HTTP server on port 3000. The companion client creates an HTTP client pointed at the same port and invokes add with two arguments, printing the result.

```js
const jayson = require('jayson');

// create a server
const server = new jayson.server({
  add: function (args, callback) {
    callback(null, args[0] + args[1]);
  },
});

server.http().listen(3000);
```

```js
const jayson = require('jayson');

// create a client
const client = new jayson.client.http({
  port: 3000,
});

// invoke "add"
client.request('add', [1, 1], function (err, response) {
  if (err) {
    throw err;
  }
  console.log(response.result); // 2
});
```

Two details in that snippet matter for anyone arriving from another RPC library. The handler signature is a single params argument plus a callback, which is exactly the change made in 3.0.0 when the collect option was removed. And the client is configured with a port rather than a URL, a reminder that transport configuration is transport specific, since TCP and TLS clients take an address and a delimiter instead.

## Promises, TypeScript declarations and a CLI client

Jayson covers the three access styles most teams ask about. Callback style is the original interface. Promise support was added in 2.0.0, with promise support for the browser client following in 3.3.3, and the promise/ directory and promise/ examples show the shape, including batches and a browser client variant. TypeScript support arrived in 2.1.0, and the repository root carries an index.d.ts alongside a typescript/ directory, so the package ships its own declarations instead of asking users to write them. The package.json scripts define a strict type check with tsc, a mocha test run and a nyc coverage run. For quick poking there is a basic CLI client in bin/jayson.js, exposed as jayson once the package is installed globally, and the README points you at the help output to see how it works.

## Where Jayson is the wrong shape of tool

Several boundaries are visible in the documentation itself. It is a library, so it does not hand you a hosted endpoint, authentication, rate limiting or a process supervisor. The README mentions a cors example and a context object that can be passed to handlers, which shows you are expected to build those layers on top. Version 3.0.0 removed the fork server and fork client, so the process forking approach that existed in 1.x is gone rather than deprecated. The 5.0.0 delimiter requirement is the sharpest edge, since a TCP or TLS peer that predates the change will stop being understood without a clear error. And for anything outside JSON-RPC the library has no answer, because the whole surface is one protocol.

## MIT licensing and an npm-only release channel

Licensing is the simplest part of the picture. The package.json names MIT as the licence, and the repository root carries a LICENSE file, so you can read the terms directly and judge how they apply to your own distribution. There is no interpretation to perform beyond reading the text yourself. The release story is less conventional: the repository has no GitHub releases at all, and versions such as 5.0.0 are published to npm, where the README's badge points at the published package. The repository itself is not archived, and the last push was on 2026-10-06, so the code is still moving. The npm scripts show a lean toolchain, with biome for linting over index.js, bin, lib, promise, examples, test and typescript, and jsdoc used to generate the class documentation published at jayson.tedeh.net.

## Conclusion

Adopt Jayson when you want a small JSON-RPC endpoint inside a node.js service, where method routing and several transports matter more than a large framework, and where you can live with the 5.0.0 delimiter rule on TCP and TLS streams. Do not adopt it if you need a hosted RPC service, a protocol other than JSON-RPC, or a release channel tied to GitHub tags, since the repository publishes no GitHub releases. Before you commit, check that every existing TCP client of yours terminates messages with the configured delimiter, and read the 5.0.0 changelog entry against your own code.

## FAQ

### How do I install Jayson in a node.js project?

The README says to install the latest version of jayson from npm with npm install jayson. For the jayson command line client in your PATH, use npm install --global jayson.

### Does Jayson support JSON-RPC 1.0 as well as 2.0?

Yes. The README states that Jayson is a JSON-RPC 2.0 and 1.0 compliant server and client, and that it is fully tested to comply with the official JSON-RPC 2.0 specification.

### What changed in Jayson 5.0.0?

The uuid dependency was removed in favour of the native crypto implementation, and the stream-json dependency was removed. TCP and TLS messages must now end with the configured delimiter, newline by default, and concatenated JSON without delimiters is no longer supported.

### Can Jayson use transports other than HTTP?

Yes. The feature list states that Jayson supports both HTTP and TCP client and server connections, and websocket client and server support was added in version 3.6.4.

### Does Jayson ship a command line client?

There is a basic CLI client in bin/jayson.js, and it should be available as jayson in your shell if you installed the package globally. Run jayson --help to see how it works.

## Sources

- [Issues](https://github.com/tedeh/jayson/issues)
- [License: MIT](https://github.com/tedeh/jayson/blob/master/LICENSE)
- [Project website](https://jayson.tedeh.net)
- [README](https://github.com/tedeh/jayson/blob/master/README.md)
- [tedeh/jayson on GitHub](https://github.com/tedeh/jayson)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/tedeh-jayson
