[Python]json对象转换出错expected string or buffer python

【问题】

今天在使用python中的json转换碰到一个问题:

 

解决方案:

原因:python中默认使用单引号表示字符串"'" 所以当,使用字符串符值以后,python会把双引号转换为单引号。

而json是不支持单引号的。可以用下面的方法转换:

json_string=json.dumps(primaryresult)
resultjson=json.loads(json_string)

原文地址:https://www.cnblogs.com/luckly-hf/p/12212593.html