There are many ways to store an array of Objects in Redis.
For example, you have this data:
id,name,age 1,Fred,25 2,Tom,28
1. Store the entire object as JSON-encoded string in a single key.
SET user:1 '{"name":"Fred","age":25}' SET user:2 '{"name":"Tom","age":28}'
2. Store each Object’s properties in a Redis hash.
HMSET user:1 name "Fred" age 25 HMSET user:2 name "Tom" age 28
3. Store each Object as a JSON string in a Redis hash.
HMSET users 1 '{"name":"Fred","age":25}' HMSET users 2 '{"name":"Tom","age":28}'
4. Store each property of each Object in a dedicated key.
SET user:1:name "Fred" SET user:1:age 25 SET user:2:name "Tom" SET user:2:age 28
You can use RedisDataStudio to import object data from files to Redis key.
For 1. Store the entire object as JSON-encoded string in a single key, you can see:
Import data from CSV file to Redis string keys in same namespace Video
Import data from Excel file to Redis string keys in same namespace Video
Import data from JSON file to Redis string keys in same namespace Video
Batch import data from CSV files to Redis string keys in same namespace Video
Batch import data from Excel files to Redis string keys in same namespace Video
Batch import data from JSON files to Redis string keys in same namespace Video
For 2. Store each Object’s properties in a Redis hash, you can see:
Import data from CSV file to Redis hash keys in same namespace Video
Import data from Excel file to Redis hash keys in same namespace Video
Import data from JSON file to Redis hash keys in same namespace Video
Batch import data from CSV files to Redis hash keys in same namespace Video
Batch import data from Excel files to Redis hash keys in same namespace Video
Batch import data from JSON files to Redis hash keys in same namespace Video
For 3. Store each Object as a JSON string in a Redis hash, you can see:
Import data from CSV file to Redis hash key Video
Import data from Excel file to Redis hash key Video
Import data from JSON file to Redis hash key Video
Batch import data from CSV files to Redis 1 hash key Video
Batch import data from Excel files to Redis 1 hash key Video