Loading Pydantic models from JSON without running out of memory

Viewed 35
The discussion centers around the challenges encountered when loading complex Pydantic models from JSON, particularly those that involve deep nesting of BaseModels and unions of BaseModels. Users are experiencing partial loading where some nested model components remain as dictionaries rather than converting fully into Pydantic models. Suggestions include considering alternative libraries like msgspec, alongside queries about the effectiveness of ijson and ujson compared to standard json loading methods. There is also a discussion about the benefits and trade-offs of using slots in Python data types for memory management.
0 Answers