Hacker News new | ask | show | jobs
by wraithm112 3246 days 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"
  }