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

【问题】

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

 

 

 

 

 

 

解决方案:

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

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

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

 

posted on 2020-01-19 10:14  zg_heng  阅读(1257)  评论(0编辑  收藏  举报

导航