'ascii' Codec Can't Decode Byte 0xc3 In Position 3
Not sure why this error is coming up because of a special character in the value, I'm trying to get the value of a key from the json using this recursive function provided by @Brie
Solution 1:
There's a couple of things wrong about your code:
- When you call on an item from JSON you should assign to variable then encode or encode as it's being loaded.
- When you encode a string, which is what
json.load
type is, you're changing it to byte. Addingstr
+byte
after you properly encode the variable will rise another error.
Try the following:
j = json.load(data_file, encoding='utf-8')
#....path = path + element + ' = ' + str(JSON[element])
Post a Comment for "'ascii' Codec Can't Decode Byte 0xc3 In Position 3"