
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
redis-json
Advanced tools
A wrapper library to store JSON Objects in redis-hashsets and retrieve it back as JSON objects
Nodejs library to store/retreive JSON Objects in RedisDB
Every time set
is called JSON object is flattened(embeded objects are converted to path keys) and then stored in Redis just like a normal hashset, on get
the hashset is unflattened and converted back to the original JSON object.
Under the hood it uses flat library for flattening and unflattening JSON objects
npm i redis-json -D
const Redis = require('ioredis');
const redis = new Redis();
const JSONCache = require('redis-json');
const jsonCache = new JSONCache(redis);
const user = {
name: 'redis-json',
age: 25,
address: {
doorNo: '12B',
locality: 'pentagon',
pincode: 123456
},
cars: ['BMW 520i', 'Audo A8']
}
await jsonCache.set('123', user)
const response = await jsonCache.get('123')
console.log(response)
// output
// {
// name: 'redis-json',
// age: 25,
// address: {
// doorNo: '12B',
// locality: 'pentagon',
// pincode: 123456
// },
// cars: ['BMW 520i', 'Audo A8']
// }
set(key, jsobObject): <Promise>
key: The redis key that the JSON object has to be stored against.
jsonObject: JSON obejct that needs to be stored.
if the key already exists, and is of type hashset, then the field in JSON object will get updated along with the existing data.
get(key) <Promise>
key: The redis key in which the JSON object was stored.
Note: if the key is not of type hashset, then redis will through error.
resave rewrite(key, jsonObj)
key: The redis key that whose value needs to be replaced with the new one. jsonObject: JSON obejct that needs to be stored.
Even if key is not of type hashset, resave rewrite will delete it and update the JSON object in the provided key.
npm test
npm run coverage
This is open-source, which makes it obvious for any PRs, but I would request you to add necessary test-cases for the same
MIT License
v2.0.0
resave
has been renamed to rewrite
FAQs
A wrapper library to store JSON Objects in redis-hashsets and retrieve it back as JSON objects
The npm package redis-json receives a total of 12,939 weekly downloads. As such, redis-json popularity was classified as popular.
We found that redis-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.