Registry / database / redis-jsonify

redis-jsonify

JSON →
library1.2.0jsnpmunverified

Automatically serializes JavaScript objects to JSON strings when using node_redis, and deserializes responses back to objects. Version 1.2.0 is stable, with no recent releases. It wraps the Redis client's send_command method to transparently convert non-Buffer values. Key differentiator: removes need for manual JSON.parse/stringify in Redis workflows. Compatible with most node_redis versions from 0.6.7 to 2.8.0 except 2.4.2 and 2.3.1.

npm install redis-jsonify
INSTALL
IMPORT
SIG · REDIS-JSONIFY
R
redis-jsonify
databasejavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jsonify
import jsonify from 'redis-jsonify'
const jsonify = require('redis-jsonify')
Default import; ESM only, no CommonJS support in latest versions.
jsonify.blacklist
jsonify.blacklist.push('command');
import { blacklist } from 'redis-jsonify'
Blacklist is a property of the default export, not a named export.

Demonstrates transparent JSON serialization/deserialization for Redis set/get operations.

import redis from 'redis'; import jsonify from 'redis-jsonify'; const client = jsonify(redis.createClient()); client.set('obj', { foo: 'bar' }, (err, result) => { if (err) throw err; client.get('obj', (err, result) => { if (err) throw err; console.log(result); // { foo: 'bar' } client.quit(); }); });
Debug
Known issues
breakingIncompatible with node_redis v2.4.2 and v2.3.1 due to internal API changes.
fix
Use node_redis v2.8.0 or v0.6.7-2.3.0, or avoid those versions.
affects: 1.2.0
gotchaThe 'list' command is blacklisted by default because its return value is an array of strings, not JSON. This can cause premature parsing errors if not accounted for.
fix
Ensure commands like LRANGE, LPOP etc. are handled manually or add to blacklist if needed.
affects: >=0.0.0
gotchaModule exports a function, not a class. Using new jsonify() will throw an error.
fix
Call jsonify(client) without new.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: jsonify is not a function
Using default import but the module does not support ESM, or using require incorrectly.
fix
Ensure you are using CommonJS: const jsonify = require('redis-jsonify'); or configure bundler for CJS.
Error: redis_parser: 1: Error: received non-zero integer type
Attempting to JSON.parse the result of a command like LIST which returns a raw string.
fix
Add the command to the blacklist: jsonify.blacklist.push('list');
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
redisrequiredpeer dependency: wraps node_redis client
Agent activity
13 hits · last 30 days
node
12
Resources
redis-jsonify — npm install redis-jsonify · libregistry