RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a...

RedisJSON is a ECMA-404 The JSON Data Interchange Standard as a native data type

RedisJSON

RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating and fetching JSON values from Redis keys (documents).

Primary features:

  • Full support of the JSON standard
  • JSONPath syntax for selecting elements inside documents
  • Documents are stored as binary data in a tree structure, allowing fast access to sub-elements
  • Typed atomic operations for all JSON values types
  • Secondary index support based on RediSearch

Quick start

Documentation

Read the docs at http://redisjson.io

Build

Make sure you have Rust installed: https://www.rust-lang.org/tools/install

Then, build as usual:

When running the tests, you need to explicitly specify the test feature to disable use of the Redis memory allocator when testing:

If you forget to do this, you'll see an error mentioning signal: 4, SIGILL: illegal instruction.

Run

Linux

Mac OS

Client libraries

Some languages have client libraries that provide support for RedisJSON's commands:

Project Language License Author Stars Package
iorejson Node.js MIT Evan Huang @evanhuang8 npm
node_redis-rejson Node.js MIT Kyle Davis @stockholmux npm
redis-modules-sdk Node.js BSD-3-Clause Dani Tseitlin @danitseitlin npm
ioredis-rejson Node.js MIT Felipe Schulz @schulzf npm
JRedisJSON Java BSD-2-Clause Redis Labs maven
redis-modules-java Java Apache-2.0 Liming Deng @dengliming maven
redisjson-py Python BSD-2-Clause Redis Labs pypi
go-rejson Go MIT Nitish Malhotra @nitishm
rejonson Go Apache-2.0 Daniel Krom @KromDaniel
NReJSON .NET MIT/Apache-2.0 Tommy Hanks @tombatron nuget
phpredis-json PHP MIT Rafa Campoy @averias composer
redislabs-rejson PHP MIT Mehmet Korkmaz @mkorkmaz composer
rejson-rb Ruby MIT Pavan Vachhani @vachhanihpavan rubygems

Acknowledgements

RedisJSON is developed with <3 at Redis Labs.

RedisJSON is made possible only because of the existance of this amazing open source project:

  • redis

License

Redis Source Available License Agreement - see LICENSE

Issues

Collection of the latest Issues

dmitsh

dmitsh

help wanted
3

name: Bug Report description: File a bug report title: "[Bug]: querying does not work for integer values" labels: [bug, triage] body:

  • type: markdown attributes: value: | Thanks for taking the time to fill out this bug report!

  • type: input id: operating_system attributes: label: OS description: Operating system and version (eg Ubuntu 20.04, OSX Catalina) placeholder: linux

  • type: architecutre id: cpu_arch attributes: label: CPU Architecture description: CPU Architecture (eg: x86, x86-64, arm, etc). placeholder: linux

  • type: input id: redis_version attributes: label: Redis Server Version description: What version of redis-server are you running (redis-server --version) placeholder: latest

  • type: input id: redis_module_version attributes: label: Redis Module Version description: What version of this redis module was installed? placeholder: latest

  • type: input id: was_redis_docker attributes: label: Docker Installation description: What version of this redis module was installed? placeholder: latest

  • type: checkboxes id: installmethod attributes: label: Docker installation description: Check this box, if you installed the release via a docker. options: - label: I installed the dockerhub release

  • type: textarea id: whathappened label: What happened? description: Please tell us what happened, and what you expected to happen. placeholder: | I'm querying the following data:

    Here is my schema: FT.CREATE userIndx ON JSON SCHEMA $.person.org AS var0 TEXT SORTABLE $.person.id AS var1 NUMERIC SORTABLE $.city AS var2 TEXT SORTABLE $.state AS var3 TEXT SORTABLE

    Here is my query: FT.SEARCH userIndx @var1:(1036) I'm getting zero results back.

    However, when I'm querying FT.SEARCH userIndx @var3:(WA), I'm getting back

  • type: textarea id: logs label: Relevant log output description: If release, please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell

vbennich

vbennich

enhancement
4

Hi, would it be possible to have a created docker image that could be run on a raspberry pi on Docker Hub? Built for arm/v7.

zhangever

zhangever

help wanted
2

I have a big json(about 20MB), and it's a huge object which has many other objects as its children. Each obj has a uid field, and i want to filter some obj out with uid. If i get all uids, then redis will return immediately。

But when i add a filter, it took several minutes before return.

Here's the cost:

other examples: is fast, but or is slow:

How can I make it faster?

Redis infos:

keywinf

keywinf

enhancement
3

Hi,

Would it be possible to reach multiple paths from the root when I use JSON.MGET. I saw that tools like Kuberbetes accept extended JSONPath formats. E.g. $.['first.path','second.deep.er.path']. I've tried it and could only get single-level paths.

Some commands do not handle multiple paths as args, like JSON.MGET (since it is already expecting multiple keys), and I wonder if the format above could be a solution.

shatilov-diman

shatilov-diman

enhancement
2

name: json.copy title: "[Proposal]: extend the RedisJSON module with json.copy command." labels: enhancement body: I believe it will be very nice to have feature to copy/move some part of json to another place Something like that: json.copy <source_key> <destination_key|@> <source_path> <destination_path|@> [nx|xx|mv] where @ at destination_key means 'equal to source_key' and @ at destination_path means 'equal to source_path'

arunura

arunura

bug
2

name: JSON.GET path syntax has an issue with filtering using an OR condition when encountering non-existent values description: The issue is specific to OR condition used in the JSONPath during JSON.GET title: "[Bug]: JSON.GET issue with using OR in JSONPath" labels: [bug, triage] body:

  • type: markdown attributes: value: | Thanks for taking the time to fill out this bug report!

  • type: input id: operating_system attributes: label: OS description: Operating system and version (eg Ubuntu 20.04, OSX Catalina) placeholder: Linux 5.8.0-1041-aws

  • type: architecutre id: cpu_arch attributes: label: CPU Architecture description: CPU Architecture (eg: x86, x86-64, arm, etc). placeholder: x86_64

  • type: input id: redis_version attributes: label: Redis Server Version description: What version of redis-server are you running (redis-server --version) placeholder: 6.2.5

  • type: input id: redis_module_version attributes: label: Redis Module Version description: What version of this redis module was installed? placeholder: ReJson 20006

  • type: input id: was_redis_docker attributes: label: Docker Installation description: What version of this redis module was installed? placeholder: Yes

  • type: checkboxes id: installmethod attributes: label: Docker installation description: Check this box, if you installed the release via a docker. options: - label: I installed the dockerhub release

  • type: textarea id: whathappened label: What happened? description: Please tell us what happened, and what you expected to happen. placeholder: Tell us what you see!

  • type: textarea id: logs label: Relevant log output description: If release, please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell

The output of the last two executions are incorrect due to the issue. The issue seems to happen when a value (eg: Paris) not present in the JSON object is used in the path query.

matteomartelli

matteomartelli

enhancement
0

Are nested filters supported, or is there any plan to support them in the future? I am referring to the feature discussed in https://github.com/json-path/JsonPath/issues/287.

For instance, consider the following json data:

I would like to retrieve the title of the book written by "Waugh", thus my JSON.GET should return "Sayings of the Century" alone. I have tried some example paths but none of them seem to work with RedisJSON (tested Redis 6.2.6 and RedisJSON built from last commit of master branch f4604f4b095edd8539dd0840ca4f810d7a3fc9ae):

JSON.GET bookstore == "Waugh")])].title' this returns the titles of all the books: "[\"SayingsoftheCentury\",\"MobyDick\"]"

JSON.GET bookstore '$.store.book[?("Waugh" == this returns an empty result "[]"

JSON.GET bookstore contains "Waugh")].title' this returns a JSON Path error

I have also tried without success with the parent operator ^ which would do the job as well (https://github.com/json-path/JsonPath/issues/287#issuecomment-428759511) : JSON.GET bookstore this returns the matched author member "[{\"firstName\":\"Evelyn\",\"lastName\":\"Waugh\"}]", but ignores the ^title sub-path.

adamwoolhether

adamwoolhether

help wanted
2

Is this possible? For example, if I have a hash with key job-id, and make entries with HSET hset job-id 3 {"id":"3","name":"jobname"} i can get all key-values of the relevant Hash with HKEYS job-id or HVALS job-id, and running keys * will just show job-id key.

This keeps the main keys organized and clean.

However, using the JSON.SET method stores each JSON string as single Key-value pair. Running keys * will list job-id1 job-id2 job-id3 etc....There is no way to get every key or value with the prefix job-id. Only the JSON.OBJKEYS would allow me to return the keys of a single JSON object...

Is there any way to use rejson while storing all the key-values under a Hash?

filipecosta90

filipecosta90

x:perf
0

We might be seeing some incomplete middle stacks due to the [unknown] within redis-server and the alloc:* methods, meaning it's not possible to pinpoint the direct caller of the expensive allocs. Nonetheless we know it comes from JSON ( rust code ).

Full flamegraph: https://s3.amazonaws.com/benchmarks.redislabs/internal-tasks/RedisJSON/PERF-186/json.set.svg

Detail of chart

image

Sample JSON.SET command:

Versions

Find the latest versions by id

v2.0.7 - Mar 11, 2022

This is a maintenance release for RedisJSON 2.0. Update urgency: LOW - No need to upgrade unless there are new features you want to use.

Details:

Improvements

  • #632, #605 Support JSON.CLEAR for string and bool and numeric scalars (MOD-2394)
  • #637 Add intershard_tls_pass support (MOD-2522)
  • #594 Support for MEMORY USAGE and memory info in JSON.DEBUG (MOD- 2079)

Bug fixes

  • #646,#644 do not fail JSON.MGET on wrong/unregistered key type (MOD-2511)
  • #643 null-terminate JSON string in rdb_save
  • #591 Avoid crash on overflow in JSON.NUMINCRBY or JSON.NUMMULTBY (MOD-2513)
  • #593 Return no updates when performing JSON.SET with NX to an existing array element (MOD-2512)

v2.0.6 - Dec 18, 2021

This is a maintenance release for RedisJSON 2.0.

Update urgency: MODERATE: Program an upgrade of the server, but it's not urgent.

This patch neutralises the increased memory consumption from v1 to v2.

Details

Improvements:

  • #563 Introduction of ijson.

v2.0.5 - Dec 01, 2021

This is a maintenance release for RedisJSON 2.0.

Update urgency: MODERATE: Program an upgrade of the server, but it's not urgent.

Details

Bug fixes:

  • #553 Return an empty array on a non-existing path
  • #548 Align error handling behavior
  • #546 #545 Fix key location in JSON.DEBUG MEMORY

v2.0.4 - Nov 16, 2021

This is the General Availability release of RedisJSON 2.0.

Headlines

RedisJSON is a high-performance JSON document store that allows developers to build modern applications. It stores and processes JSON in-memory, supporting millions of operations per second with sub-millisecond response times. With the combination of RediSearch, native indexing, querying, and full-text search of JSON documents allows developers to create secondary indexes, and query data at lightning speed.

Indexing JSON documents

Using RediSearch, it is now possible to index, query, and search JSON documents, gaining full-text search capabilities and document retrieving based on their content.

To do so, you must install both modules, RedisJSON and RediSearch on the same database.

Support of JSON Path

The commands support JSONPath as specified in the original specifications.

The legacy path syntax is still supported.

Commands operate on multiple paths.

A JSONPath query may resolve to several paths. Every command supports multiple paths and applies the operation to all the encountered paths.

Notice that the output of the commands evolved to provide multiple results according to the number of paths impacted.

Details

Enhancements

  • Support of Multipath - (#473)(#477) (#491(#531) (#519)(#511)(#503) (#497) (#516)
  • Added generic json path implementation (#336)
  • Error messages prefixed with ERR or WRONGTYPE (#525)
  • Performance: Discard of method to_value (#490)
  • Move from next_string to next_str (#426)
  • Initial RedisJSON commands.json file (#464)
  • Docker with RediSearch revisited (#488)

Bug fixes

  • JSON.DEL count deleted null value (#515)
  • Avoid crash in ARRTRIM (#499)
  • Docker/Debian: moved from Buster to Bullseye (#458)
  • Support RDB Short Read in RedisJSON (a.k.a diskless-load) (#397)
  • Avoid path clone when not needed (#398)
  • Add testGetWithBracketNotation (#416)

Notes: This is the first GA version of 2.0. The version inside Redis will be 2.0.4 in semantic versioning. Since the version of a module in Redis is numeric, we could not add a GA flag.

v1.0.8 - Aug 10, 2021

This is a maintenance release for version 1.0. Update urgency: LOW - No need to upgrade unless there are new features you want to use.

Headlines: This release improves overall stability and provides fixes for issues found after the previous release.

Details:

  • Enhancements:

    • #257 Support inter shards TLS capability
  • Bug fixes:

v2.0.0 - Jul 07, 2021

This is the first release candidate for RedisJSON 2.0

Highlights:

This release includes two major new features:

  • Full support for JSONPath with JSON.GET when using a regular JSONPath expression (starting with $).
  • Introduction of an API exposing the JSON data type to RediSearch. This is related to RediSearch 2.2-RC1.

Lean more by reading the blog post: Indexing, querying and full-text search of JSON documents with Redis

Notes:

  • Requires Redis v6 or above
  • This is not the GA version of 2.0. The version inside Redis will be 20000 or 2.0.0 in semantic versioning. Since the version of a module in Redis is numeric, we could not add an RC1 flag.
  • For production usage, please use the latest RedisJSON 1.0.

v1.0.7 - Dec 30, 2020

This is a maintenance release for version 1.0. Update urgency: Medium

Headlines: This release improves overall stability and provides fixes for issues found after the previous release.

Details:

  • #222 Validate path is not empty.
  • #253 NULL de-reference after error.

v1.0.5 - Sep 07, 2020

This is a maintenance release for version 1.0. Update urgency: Low

Headlines:

  • This release improves overall stability and provides fixes for issues found after the previous release.

Details:

  • Enhancements:
    • Republish docker image based on Redis 6
  • Bugfixes:
    • #200 Following a call to JSON.ARRPOP and JSON.STRAPPEND, the LRU cache should be invalidated.

v1.0.4 - Feb 21, 2019

v1.0.3 - Sep 12, 2018

This release disables the cache by default, and allows an explicit CACHE <ON|OFF> module argument to enable it.

v1.0.2 - Sep 10, 2018

This release contains some bug fixes over 1.0.2. It also includes some ci changes as well.

v1.0.1 - Dec 28, 2017

v0.99.1 - Nov 14, 2017

Nothing new - just updated travis rules to make it build a proper archive.

v0.99.0 - Nov 14, 2017

This is the beta release of ReJSON

Information - Updated Mar 29, 2022

Stars: 3.1K
Forks: 239
Issues: 79

serde-json for no_std programs

MIT license (LICENSE-MIT or

serde-json for no_std programs
JSON

591

JSON parser which picks up values directly without performing tokenization in Rust

This JSON parser is implemented based on an abstract that utilizes in memory indexing and parsing

JSON parser which picks up values directly without performing tokenization in Rust
JSON

3.0K

Serde JSON  

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically

Serde JSON  

SIMD JSON for Rust  

Rust port of extremely fast serde compatibility

SIMD JSON for Rust  

JSON-E Rust data-struct paramter crate for lightweight embedded content with objects and much more

What makes JSON-e unique is that it extensive documentation and ease of use

JSON-E Rust data-struct paramter crate for lightweight embedded content with objects and much more

JSON-RPC library designed for async/await in Rust

Designed to be the successor to tracking issue for next stable release (0

JSON-RPC library designed for async/await in Rust
JSON

140

json_typegen - Rust types from JSON samples

json_typegen is a collection of tools for generating types from

json_typegen - Rust types from JSON samples

JSON File Parser

A CLI application that reads from a stream of JSON files, and computes some data-quality metrics

JSON File Parser
Facebook Instagram Twitter GitHub Dribbble
Privacy