@hackage generic-aeson0.1.1
Derivation of Aeson instances using GHC generics.
Installation
Dependencies (8)
- aeson >=0.6 && <0.9
- attoparsec >=0.11 && <0.13
- base >=4.6 && <4.8
- generic-deriving >=1.6 && <1.7
- mtl >=2.0 && <2.3
- tagged >=0.2 && <0.8 Show all…
Dependents (7)
@hackage/acme-everything, @hackage/mu-servant-server, @hackage/rest-gen, @hackage/json-schema, @hackage/rest-example, @hackage/planet-mitchell, Show all…
generic-aeson
The structure of the generated JSON is meant to be close to idiomatic JSON. This means:
-
Enumerations are converted to JSON strings.
-
Record fields become JSON keys.
-
Data types with one unlabeled field convert to just that field.
-
Data types with multiple unlabeled fields become arrays.
-
Multiple constructors are represented by keys.
-
'Maybe' values are either an absent key, or the value.
See tests/Main.hs for more examples.