0

I want to import data from json file into python file here is my line of code

    with open('data.json')as f:
       obj = json.load(f)
    q = (obj['ques'])

But this error is showing.

    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 743: character maps 
    to <undefined>

The json file imported here has simple questions with options and their right answers.

    "ques": [
    "Q1. I often have to struggle to see things from another’s point of 
    view.",....
    "ans": [
    2,
    2,
aslan
  • 1
  • 1
  • We can’t tell you the correct encoding without seeing (a representative, ideally small sample of) the actual contents of the data in an unambiguous representation; a hex dump of the problematic byte(s) with a few bytes of context on each side is often enough, especially if you can tell us what you think those bytes are supposed to represent. See also https://meta.stackoverflow.com/questions/379403/problematic-questions-about-decoding-errors – tripleee Sep 03 '21 at 15:33

0 Answers0