api-field-json-th-0.1.0.1: option of aeson's deriveJSON

Safe HaskellNone
LanguageHaskell2010

Data.Aeson.APIFieldJsonTH

Contents

Description

Utils for using aeson's deriveJSON with lens's makeFields

Synopsis

How to use this library

data SomeQuery = SomeQuery {
    _someQueryPage :: Int
    , _someQueryText :: String
} deriving (Eq, Show)
makeFields ''SomeQuery
deriveApiFieldJSON ''SomeQuery

This is compatible with the next json

{"page": 3, "text": "foo"}

deriveApiFieldJSON :: Name -> Q [Dec] Source

レコード名を落としてjsonインスタンス化