Say I have this json code
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
How could I store it to a redisdb via redis-py?
My code is the following (I believe it's wrong):
import json
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=1)
with open('json_test.json', encoding='utf-8') as data_file:
test_data = json.loads(data_file.read())
r.hmset('test_json', test_data)