Preface: recently, I crawled a JS file on the Internet and filtered out the final text information. It seems that it is the str type of a dictionary. I used the JSON module of Python to import, that is, the loads function, but an error was reported: valueerror: expected property name: Line 1 column 2 (char 1)
Later, it was found that Jason didn’t support the value of single quotation mark modified attribute
However, the method of converting Python strings to dictionaries is more than just JSON. Loads(), which cleverly uses Python’s built-in function eval() to convert strings into dictionaries
It perfectly solves the disadvantage that Jason’s loads () does not support single quotation marks
Similar Posts:
- [Solved] TypeError: string indices must be integers, not str
- [Solved] json.decoder.JSONDecodeError: Expecting ‘,‘ delimiter: line xx column xx (char xxx)
- Python: How to Solve raise JSONDecodeError(“Expecting value”, s, err.value) from None json.decoder…
- [Solved] Python error: attributeerror: type object ‘STR’ has no attribute ‘_name_’ (machine learning practice treeplotter code)
- TypeError: Object of type ‘datetime‘ is not JSON serializable [Solved]
- [Solved] json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- TypeError: the JSON object must be str, not ‘bytes’
- UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-1:
- Python: json:json.decoder.JSONDecodeError: Invalid control character at: line 2 column 18 (char 19)