poem icon indicating copy to clipboard operation
poem copied to clipboard

How come `ToJSON` and `ParseFromJSON` exist?

Open banool opened this issue 2 years ago • 3 comments

Hey, as I look through more of the codebase, I so far see that every implementation of ToJSON / ParseFromJSON just calls out to serde directly. I wonder why these traits exist, couldn't we just use Serialize and Deserialize?

banool avatar Jul 27 '22 20:07 banool

In a similar sense, is serde the best candidate for json serialisation here? Are there maybe better performing/smaller/lighter crates to use for JSON?

Christoph-AK avatar Jul 29 '22 07:07 Christoph-AK

Not using serde to parse and serialize json.

sunli829 avatar Jul 30 '22 13:07 sunli829

As a note to this, we use it when mirroring and transforming internal API responses.

The separation lets us use the same model but with different serialization/deserialization behaviours between them. (Mostly with renaming)

ChillFish8 avatar Aug 06 '22 14:08 ChillFish8

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 06 '22 04:09 github-actions[bot]