Python’s wonderful standard library to the rescue…
import codecs
reader = codecs.getreader("utf-8")
obj = json.load(reader(response))
Works with both py2 and py3.
More Related Contents:
- Why doesn’t Python recognize my utf-8 encoded source file?
- Trying to parse `request.body` from POST in Django [duplicate]
- Should I use encoding declaration in Python 3?
- Python 3: How to specify stdin encoding
- Serialising an Enum member to JSON
- pandas.io.json.json_normalize with very nested json
- OpenAI GPT-3 API error: “Cannot specify both model and engine”
- Switching to Python 3 causing UnicodeDecodeError
- Changing the “locale preferred encoding” in Python 3 in Windows
- Python 3 CSV file giving UnicodeDecodeError: ‘utf-8’ codec can’t decode byte error when I print
- json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 190) [duplicate]
- Json Encoder AND Decoder for complex numpy arrays
- Handle JSON Decode Error when nothing returned
- Fixed digits after decimal with f-strings
- Print multiple arguments in Python
- Why does Python print unicode characters when the default encoding is ASCII?
- How to convert a file to utf-8 in Python?
- How to get if a key is pressed pygame [duplicate]
- Pickle or json?
- cx_Freeze converted GUI-app (tkinter) crashes after pressing plot button
- Python pandas: remove everything after a delimiter in a string
- How to get the physical interface IP address from an interface
- Difference between “grid” and “pack” geometry managers
- TypeError: object() takes no parameters after defining __new__
- Convert numpy type to python
- Windows can’t find the file on subprocess.call()
- Rounding error in Python with non-odd number? [duplicate]
- What are the differences between bool() and operator.truth()?
- Python 3 chokes on CP-1252/ANSI reading
- Using Sympy Equations for Plotting