For this quick start, you will need the following:

Create a new database that uses the Module

  1. In the Redis Modules field, click Add.
  2. Select the RedisJSON module.
  3. If you want the module to use a custom configuration, click Add configuration and enter the optional custom configuration.
  4. Click Save.

    For example:

  5. Click the Activate button

Quick start with redis-cli

These examples will use redis-cli as the Redis client to show how easy it is. The first RedisJSON command to try out is JSON.SET, which sets a Redis key with a JSON value. All JSON values can be used, for example a string:

Connect to redis using --raw to maintain file formatting.

$ redis-cli --raw -p 12543>

Run these commands:

Add a simple document> JSON.SET foo . '{"foo" : "bar"}'

Read back the only entity with a get> JSON.GET foo

Check what type foo is> JSON.TYPE foo .

See what type of entity the foo entity is in the foo document.> JSON.TYPE foo .foo

Now that we have a minimal JSON document. Add some more data to it. The great thing is, we do not need the entire document, we only write what needs to change. Add an entity into the document called test with a integer value of 1.> JSON.SET foo .test 1

Next increment that value by 2 and this returns the updated value.> JSON.NUMINCRBY foo .test 2

Now create a new document, add another document to it, and then add another name/value pair to that sub-document.> JSON.SET foo . '{"foo":"bar"}'

Add the test entity with a JSON document> JSON.SET foo .test '{"test2":true}'

Add another entity to the test document> JSON.SET foo .test.test3 '"test"'