3 ms·
With respect to the snake-cased fields issue, it's actually not that hard to do that with Generic in Haskell. data Person = Person { personFirstName :
by wraithm112 9y ago
With respect to the snake-cased fields issue, it's actually not that hard to do that with Generic in Haskell.
data Person = Person
{ personFirstName :: Text
, personLastName :: Text
} deriving (Generic)
instance ToJSON Person where
toJSON = genericToJSON $ aesonPrefix snakeCase
instance FromJSON Person where
parseJSON = genericParseJSON $ aesonPrefix snakeCase
Which produces messages like:
{
"first_name": "John",
"last_name": "Doe"
}