3 ms·
Pydantic also have support for parsing partial JSON. https://docs.pydantic.dev/latest/concepts/json/#partial-json-parsing https://docs.pydantic.dev/latest/conce
by jackmpcollins 2y ago
Pydantic also have support for parsing partial JSON. https://docs.pydantic.dev/latest/concepts/json/#partial-json-parsing https://docs.pydantic.dev/latest/concepts/json/#partial-json...
from pydantic_core import from_json
partial_json_data = '["aa", "bb", "c'
result = from_json(partial_json_data, allow_partial=True)
print(result)
#> ['aa', 'bb']
You can also use their `jiter` package directly if you don't otherwise use pydantic. https://github.com/pydantic/jiter/tree/main/crates/jiter-python https://github.com/pydantic/jiter/tree/main/crates/jiter-pyt...
- simonw 2y agoThat's neat, I hadn't seen that. Docs were lacking so I submitted a PR: https://github.com/pydantic/jiter/pull/143 https://github.com/pydantic/jiter/pull/143