【发布时间】:2015-08-19 21:41:46
【问题描述】:
我有一个巨大的 json 文件想要传输到 csv。我在互联网上搜索了很多,我尝试自己编写 Python,但没有任何效果。我在这里被困了一个星期。有人可以帮我吗? json文件格式为:
{"Gid": "5999043768223797248",
"rights": [{"grantorContext": "Freemium right added by Netlife", "sku": "CMO-STO-2-FREE", "rightId": "5340e29a6dc01000", "grantorId": "NETLIFE_B2C"}],
"used_quota": "16.95",
"creationtime": "2001-04-29 12:58:33",
"devices": [{"last_connection": "2001-05-30 22:06:08", "os_version": "4.2.2", "auto_upload": "wifi", "last_upload": "2002-04-29 13:12:26", "device_name": "i-mobile i-STYLE 7.5", "platform": "unknow", "client_version": "2.0.0"}],
"total_quota": 2.0,
"Uid": ["666927729520"]}
{"Gid": "5999043740151320576",
"rights": [{"grantorContext": "Freemium right added by Netlife", "sku": "CMO-STO-2-FREE", "rightId": "5340e29f72c05000", "grantorId": "NETLIFE_B2C"},
{"grantorContext": null, "sku": "CMO-STO-25-M", "rightId": "53b5d2d8b0400000", "grantorId": "DTN"}],
"used_quota": "480.85",
"creationtime": "2001-04-29 12:58:38",
"devices": [{"last_connection": "2001-08-02 03:46:05", "os_version": "8.4", "auto_upload": "wifi", "last_upload": "2015-08-02 03:46:05", "device_name": "Nokia", "platform": "unknow", "client_version": "1.0.0"}],
"total_quota": 27.0,
"Uid": ["465949097714"]}
{"Gid": "5999043675907166208",
"rights": [{"grantorContext": null, "sku": "CMO-STO-25-M", "rightId": "53b5d2e161000000", "grantorId": "DTN"},
{"grantorContext": "Freemium right added by Netlife", "sku": "CMO-STO-2-FREE", "rightId": "5340e29b42805000", "grantorId": "NETLIFE_B2C"}],
"used_quota": "8.26",
"creationtime": "2001-04-29 12:58:35",
"devices": [{"last_connection": "2001-04-29 13:08:24", "os_version": "4.2.2", "auto_upload": "wifi", "last_upload": "2002-04-29 13:03:25", "device_name": "Nokia V797", "platform": "unknow", "client_version": "2.0.0"}],
"total_quota": 27.0,
"Uid": ["666994575443"]}
【问题讨论】:
-
如果尽管你尝试了一切都没有任何效果,那么我们都注定要失败,世界即将结束。但是我对此表示怀疑,所以请发布您的一些尝试并解释会发生什么以及应该发生什么。
-
如果您从一个小的 JSON 文件开始并编写一个程序将其转换为 CSV,那么这将是解决您的巨大问题的一步吗?
-
JSON 文件有多大?
-
搜索'python convert json csv'(不带''引号)或'python read huge json'都会产生很多答案,包括stackoverflow上的几个。
-
谢谢你们的所有回答,伙计们。该文件到今天为止是 350M,并且增长很快。我还在挣扎,任何帮助都会很好。