我有一个名为
意思是,该文件包含许多由“,”分隔的文档。我该如何单独读取每个JSON文档并在Python中处理它(将其发送到REST API)?附注:原始文件可能有几GB的大尺寸。
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"
}]
意思是,该文件包含许多由“,”分隔的文档。我该如何单独读取每个JSON文档并在Python中处理它(将其发送到REST API)?附注:原始文件可能有几GB的大尺寸。
[]
对?你的问题是关于分割输入吗? - user1907906sed
这样的外部工具将输入拆分成许多小文件。 - user1907906