在将数据帧转储到json时会得到转义字符和双qoutes
Expected Output :
"[{"a":"1","b":"5"},
{"a":"2","b":"6"},
{"a":"3","b":"7"},
{"a":"4","b":"8"}]"
Result :
"[{\"a\":\"1\",\"b\":\"5\"},
{\"a\":\"2\",\"b\":\"6\"},
{\"a\":\"3\",\"b\":\"7\"},
{\"a\":\"4\",\"b\":\"8\"}]"
AB1 = AB.to_json(orient='records',encoding='utf-8')
return json.dumps(AB1)
答案 0 :(得分:0)
您不需要to_json部分。根据您输入的内容,只使用一个或多个转储。