1

I am trying to write and retrive a JSON with Special characters to REDIS but the special characters are getting converted

The special character Mój is getting converted to Mój and Můj is converted to Můj

from rejson import Client, Path
import json


rj = Client(host='localhost', port=6360, decode_responses=True)

app_details2 = {
  "applist": [
    {
      "appname": "Mój",
      "country": "PL"
    },
    {
      "appname": "Můj",
      "country": "CZ"
    }   
  ],
  "lasttimestamp": "2021-01-03 12:58:26",
  "loadtype":"F"
}

rj.jsonset('app_details', Path.rootPath(),app_details)
valo = rj.jsonget('app_details',Path('.applist'))
print(type(valo[0]))
print(valo)

for i in valo:
    app = i["appname"]
    country = i["country"]
    print(app)
   
Debashish Das
  • 69
  • 1
  • 5

1 Answers1

1

The issue was resolved by adding a extra parameter to the JSONGET

valo = rj.jsonget('app_details',Path('.applist'),no_escape=True)

This solved the problem and data is getting fetched properly

Debashish Das
  • 69
  • 1
  • 5