sayan_sen
sayan_sen

Reputation: 345

How to retain special character from a json file while reading into python

I have an entry in Json called J as follows:-

    {
     "list_1":["numeral sejío"]

When I am reading it into python as

    newlist=J.list_1

The result is being shown as

      ['numeral sejÃ\xado']

I want to retain the original one. Can anyone help? The issue does not occur is the list_1 declaration is in single quotes, however in a json file, cannot do it.

Upvotes: 1

Views: 1027

Answers (1)

DataSciRookie
DataSciRookie

Reputation: 1200

try this : json.loads(in_string).encode("latin_1").decode("utf_8")

Upvotes: 2

Related Questions