tinycodinglm / misc /misc-0017-p3.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame Contribute Delete
683 Bytes
deepseek-harness trace
System You are a helpful Python tutor.

You are a helpful Python tutor.

User

How do I parse a very large JSON file (several GB) without loading it all into memory in Python?

Assistant
markdown
# pip install ijson
import ijson

with open("giant_data.json", "rb") as f:
    for log in ijson.items(f, "logs.item"):
        if log.get("level") == "error":
            print("Found an error log block entry!")