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)
   

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.