Remix.run Logo
scolvin 7 months ago

Pydantic author here. We have plans for an improvement to pydantic where JSON is parsed iteratively, which will make way for reading a file as we parse it. Details in https://github.com/pydantic/pydantic/issues/10032.

Our JSON parser, jiter (https://github.com/pydantic/jiter) already supports iterative parsing, so it's "just" a matter of solving the lifetimes in pydantic-core to validate as we parse.

This should make pydantic around 3x faster at parsing JSON and significantly reduce the memory overhead.

Lucasoato 7 months ago | parent | next [-]

Pydantic is a life changing library, thanks so much for your work!

adeeshaek 7 months ago | parent [-]

Seconded. Please keep up the awesome work!

itamarst 7 months ago | parent | prev [-]

That's great! Would also be cool (separately from Pydantic use case) to add jiter backend to ijson.