Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sorry to be a hater, but wouldn’t using Pydantic be better in almost every circumstance here?


Pydantic is great lib and and has many advantages over Jsonic,

I think main use cases for Jsonic over Pydantic are: - You already have plain Python classes or dataclasses and don’t want to convert them to BaseModel - You prefer minimal intrusion - no inheritance, no decorators, no schema definitions - You need to serialize and deserialize Pydantic models alongside non-Pydantic classes

Having said that, Pydantic is the better choice in most cases.

This is also why Jsonic integrate natively with Pydantic so you can serialize Pydantic models using Jsonic out of the box


I can see that. Pydantic is great but relatively slow (which matters on edge devices) and can be bloated.

The fact that all your projects use Pydantic makes it an easy starting point and created standardisation - of course.

Nevertheless, I can definitely see some use-cases for lightweight JSON-serialisation without bringing in Pydantic. Dataclasses are great, but lack proper json handling.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: