32 ms·
> In Haskell it's a bit more awkward, but you can kinda pull something similar off in terms of ergonomics. I've not worked with JSON in Haskell that much that I
by dwohnitmok 5y ago
> In Haskell it's a bit more awkward, but you can kinda pull something similar off in terms of ergonomics. I've not worked with JSON in Haskell that much that I need to look for it, but I don't remember there being something as ergonomic as serde.
I think Haskell's most popular JSON library aeson is basically the same thing and probably a source of inspiration for serde.
data MyCustomType = ... deriving (Generic, ToJSON, FromJSON)
or if you want more control you can use deriving-aeson
-- I prefer snake case instead
data MyCustomType = ...
deriving Generic
deriving (FromJSON, ToJSON)
via CustomJSON '[FieldLabelModifier CamelToSnake]
- spoiler 5y agoAh, I've heard about aeson, but not used it. Thanks for pointing it out!