请问我这样写的json文件导入es格式对吗,总是报错,并且中文不显示,求解答谢谢!

中文不显示是因为没加上encoding="utf-8“吗,加上就报错》。。。目前格式这样

fieldnames = ("id","text")
index ={'index':{}}
reader = csv.DictReader( csvfile, fieldnames)
next(reader) 
for row in reader:
    json.dump(index,jsonfile)
    jsonfile.write('\n') 
    json.dump(row, jsonfile)
    jsonfile.write('\n')    

图片说明

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^