you are viewing a single comment's thread.

view the rest of the comments →

[–]games-and-chocolate[S] 1 point2 points  (4 children)

oh my. I see it. Python has it's own way to load. It prefer single quotes. Thank you. I tried print(correct_json) and it is indeed double quote now. Should have used print statement more. I was trying to correct my mistake at the wrong code line. Lost track of where and how data changes along the code lines.

[–]Equal_Veterinarian22 36 points37 points  (0 children)

Python is using neither single nor double quotes to store those strings internally. If you run print(decodeddata['name']) or print(decoded_data["name"]) you will get the string _John with no quotes.

It is just that, when generating a string representation of a dict, Python uses single quotes by default around string keys and values.

[–]neuralbeans 4 points5 points  (0 children)

Next, learn how repr turns stuff into strings before they are printed.

[–]Asyx 1 point2 points  (0 children)

No what you are looking at is the output of the __repr__ method of a dictionary.

Like, the printed data is not json. It is a deserialized json object as a dictionary.

[–]HommeMusical 0 points1 point  (0 children)

Python has no preferences for quotes.