I encountered a problem in my recent work. Execute JSON. Loads (JSON)_Data), in JSON_An error will be reported after adding a tab space to the data. If not, no error will be reported
1、 Json.loads (JSON)_Data) error json.decoder.jsondecodeerror: invalid control character at: line 25 column 18 (char 18)
Reason: JSON uses strict format by default, and JSON_There are illegal control symbols in the data key value, such as \ n \ T. this error is easy to report when data is passed across languages
Solution: add the parameter strict
json.loads(json_data, strict=False)
2、 JSON. Dumps (data) converts Chinese characters to unicode encoding
Reason: JSON performs character conversion by default
Solution: add ensure_ASCII parameters
json.dumps(data, ensure_ascii=False)