Nathaniel
Nathaniel

Reputation: 3

Does iJson.items() load the entire JSON file into memory before iterating?

I've recently started using iJson to iteratively pass through my JSON data. I will be working with HUGE JSON files (100+ GB).

The docs for iJson are quite limited and did not mention much, so they were of little help in answering my question.

Does iJson.items() load the entire JSON file into memory when called upon?

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

Upvotes: 0

Views: 482

Answers (1)

user2357112
user2357112

Reputation: 280838

No, it doesn't. Loading everything immediately would defeat the entire point of ijson, which is to not do that. You can take a look at the source for the various backends (the pure-Python backend is the default) if you want to confirm it.

Upvotes: 1

Related Questions