Popularity
5.7
Declining
Activity
0.0
Stable
15
0
3

Monthly Downloads: 89
Programming language: Haskell
License: MIT License
Tags: Data     Web     Aeson    
Latest version: v0.1.1.0

aeson-casing alternatives and similar packages

Based on the "aeson" category

Do you think we are missing an alternative of aeson-casing or a related project?

Add another 'aeson' Package

README

aeson-casing

Tools to change the formatting of field names in Aeson instances.

The casing utilities allow you to specify how Aeson renders and parses the field names in JSON messages. Snake, Camel, and Pascal case are all supported. To include casing modifiers in Aeson, attach options to instances of ToJSON and FromJSON.

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

The above code will produce JSON messages like the following...

{
    "first_name": "John",
    "last_name": "Doe"
}