Safe Haskell | None |
---|---|
Language | Haskell98 |
- type Value = SomeValue Immutable
- type Object = SomeObject Immutable
- data Options :: * = Options {}
- defaultOptions :: Options
- data SumEncoding :: *
- defaultTaggedObject :: SumEncoding
- camelTo :: Char -> String -> String
Documentation
data Options :: *
Options that specify how to encode/decode your datatype to/from JSON.
Options | |
|
Default encoding Options
:
Options
{fieldLabelModifier
= id ,constructorTagModifier
= id ,allNullaryToStringTag
= True ,omitNothingFields
= False ,sumEncoding
=defaultTaggedObject
,unwrapUnaryRecords
= False }
data SumEncoding :: *
Specifies how to encode constructors of a sum datatype.
TaggedObject | A constructor will be encoded to an object with a field
|
ObjectWithSingleField | A constructor will be encoded to an object with a single
field named after the constructor tag (modified by the
|
TwoElemArray | A constructor will be encoded to a 2-element array where the
first element is the tag of the constructor (modified by the
|
defaultTaggedObject :: SumEncoding
Default TaggedObject
SumEncoding
options:
defaultTaggedObject =TaggedObject
{tagFieldName
= "tag" ,contentsFieldName
= "contents" }
camelTo :: Char -> String -> String
Converts from CamelCase to another lower case, interspersing
the character between all capital letters and their previous
entries, except those capital letters that appear together,
like API
.
For use by Aeson template haskell calls.
camelTo '_' 'CamelCaseAPI' == "camel_case_api"