Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- customOptions :: Options
- customOptions = defaultOptions
- { fieldLabelModifier = tail
- , constructorTagModifier = map toLower
- , unwrapUnaryRecords = True
- }
- data Auth = Auth
- { _username :: String
- , _password :: String
- } deriving (Generic, Show)
- instance ToJSON Auth where
- toEncoding = genericToEncoding customOptions
- instance FromJSON Auth where
- parseJSON = genericParseJSON customOptions
- -- res <- post url (toJSON auth)
- -- vs.
- -- res <- post url (encode auth)
Add Comment
Please, Sign In to add comment