From the course: Advanced Redis
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Performing operations on JSON objects - Redis Tutorial
From the course: Advanced Redis
Performing operations on JSON objects
After exploring a re operations, let's explore some operations you can perform on JSON objects. I use JSON .SET to set a new user corresponding to the key user: Sheila. The JSON object associated with this key contains a number of different attributes for Sheila, such as ID, name, location, department and so on. We've already seen how we can use the Redis serialization protocol to view a particular object, and here are the attributes for the Sheila user. Observe that this JSON object has five top level attributes, ID, name, location, department and mail. Now you can get the number of fields in a JSON object using JSON.OBJLEN. Notice that the result here is five. You can also get the number of attributes for a nested object using JSON.OBJLEN Here I want to know how many nested attributes are present for the mail top level attribute for our Sheila object. And the result here is two. Every JSON object comprises of attributes and corresponding values or keys and values. You can use…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Working with JSON objects3m 52s
-
(Locked)
Working with JSON arrays7m 3s
-
(Locked)
Performing operations on JSON arrays3m 22s
-
(Locked)
Performing operations on JSON objects1m 33s
-
(Locked)
Performing operations on strings and numeric values in JSON3m 42s
-
(Locked)
Searching JSON documents3m 47s
-
(Locked)
-