Skip to content
Loading Pydantic models from JSON without running out of memory episode artwork

May 23, 2025

Loading Pydantic models from JSON without running out of memory

from 耳で聞くHacker News

Pydanticで巨大なJSONファイルをメモリ不足にならずに読み込む方法についての記事です。通常の`model_validate_json()`ではJSONファイルの約20倍のメモリを消費しますが、`ijson`というストリーミングJSONパーサーと`@dataclass(slots=True)`を組み合わせることで、メモリ使用量を大幅に削減できます。これにより、より大きなJSONファイルを効率的に処理できます。

Episode details come from the podcast's RSS feed.

Embed this episode

Ready to play

Loading Pydantic models from JSON without running out of memory

No transcript yet.

Requests help us decide what to transcribe next.

Frequently asked questions

When was this 耳で聞くHacker News episode published?

This episode was published on May 23, 2025.

Can I download this 耳で聞くHacker News episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.