【问题标题】:Does iJson.items() load the entire JSON file into memory before iterating?iJson.items() 是否在迭代之前将整个 JSON 文件加载到内存中?
【发布时间】:2019-05-21 21:23:15
【问题描述】:

我最近开始使用 iJson 迭代地传递我的 JSON 数据。我将使用巨大的 JSON 文件 (100+ GB)。

iJson 的文档非常有限,没有提及太多,因此它们对回答我的问题帮助不大。

iJson.items() 调用时是否会将整个 JSON 文件加载到内存中?

list = ijson.items(in_file)
# Does this load the entire contents of in_file to memory?

【问题讨论】:

    标签: python json ijson


    【解决方案1】:

    不,它没有。立即加载所有内容会破坏ijson 的全部意义,即不这样做。如果您想确认,可以查看各种后端的sourcepure-Python backend 是默认值)。

    【讨论】:

    • 这对我有很大帮助——谢谢!
    猜你喜欢
    • 2016-08-24
    • 1970-01-01
    • 1970-01-01
    • 2012-05-07
    • 1970-01-01
    • 2016-11-03
    • 1970-01-01
    • 1970-01-01
    • 2019-03-07
    相关资源
    最近更新 更多