我有一个名为example.json
的json文件,包含以下内容
[{
"product/productId" : "XXX",
"product/title" : "14k Yellow Gold Butterfly Pendant, 16 ",
"product/price" : "unknown",
"review/userId" : "XXX",
"review/profileName" : "Disappointed Sony customer",
"review/helpfulness" : "1/1",
"review/score" : "4.0",
"review/time" : "1178150400",
"review/summary" : "pretty necklace",
"review/text" : "It is a nice made necklace, and the butterfly pendant looks beautiful. I love it.",
"numOfPositive" : "2",
"numOfNegative" : "0"
},
{ "product/productId" : "XXXX",
"product/title" : "14k Yellow Gold Butterfly Pendant, 16 ",
"product/price" : "unknown",
"review/userId" : "TTT",
"review/profileName" : "A. Thorpe Amazon lover ",
"review/helpfulness" : "1/1",
"review/score" : "4.0",
"review/time" : "1175990400",
"review/summary" : "pretty necklace",
"review/text" : "I bought this necklace on a whim; I love butterflies and it looked so dainty anadfasdfasdfd sweet. It was actually a little more weighty than I expected, although it's not a solid piece. The chain is shiny and nicer than I expected.",
"numOfPositive" : "4",
"numOfNegative" : "0"
}]
意思是-文件包含由“,”分隔的文件分配。 如何在python中分别读取和处理每个json文档(将其发送到rest api)? 附笔 原始文件可以有几个GB的大容量
用任何文本编辑器打开文件。在文件的开头添加一个
[
,在结尾添加一个]
。这将把您拥有的数据转换为实际有效的JSON数组。然后使用json module来处理它。
相关问题 更多 >
编程相关推荐