| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
JavaScript.JSON.Types
- 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.
Constructors
| Options | |
Fields
| |
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.
Constructors
| TaggedObject | A constructor will be encoded to an object with a field
|
Fields | |
| 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
|
Instances
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"