composite-aeson-0.1.1.0: JSON for Vinyl/Frames records

Safe HaskellNone
LanguageHaskell2010

Composite.Aeson.Default

Synopsis

Documentation

class DefaultJsonFormat a where Source #

Class for associating a default JSON format with a type.

DO NOT use this as the primary interface. It should only be used for defaulting in contexts where an explicit choice can also be used.

Minimal complete definition

defaultJsonFormat

Methods

defaultJsonFormat :: JsonFormat e a Source #

Produce the default JsonFormat for type a, which must not produce any custom errors.

Instances

DefaultJsonFormat Bool Source # 
DefaultJsonFormat Char Source # 
DefaultJsonFormat Double Source # 
DefaultJsonFormat Float Source # 
DefaultJsonFormat Int Source # 
DefaultJsonFormat Int8 Source # 
DefaultJsonFormat Int16 Source # 
DefaultJsonFormat Int32 Source # 
DefaultJsonFormat Int64 Source # 
DefaultJsonFormat Word8 Source # 
DefaultJsonFormat Word16 Source # 
DefaultJsonFormat Word32 Source # 
DefaultJsonFormat Word64 Source # 
DefaultJsonFormat String Source # 
DefaultJsonFormat Text Source # 
DefaultJsonFormat Scientific Source # 
DefaultJsonFormat Object Source # 
DefaultJsonFormat Array Source # 
DefaultJsonFormat Value Source # 

aesonJsonFormat :: (ToJSON a, FromJSON a) => JsonFormat e a Source #

Produce an explicit JsonFormat by using the implicit Aeson FromJSON and ToJSON instances.

If an aeson-better-errors parser is available for a, it's probably better to use abeJsonFormat to get the enhanced error reporting.

abeJsonFormat :: ToJSON a => Parse e a -> JsonFormat e a Source #

Produce an explicit JsonFormat by using the implicit Aeson ToJSON instance and an explicit aeson-better-errors Parse.

boolJsonFormat :: JsonFormat e Bool Source #

JsonFormat for Bool, mapping to a JSON boolean.

charJsonFormat :: JsonFormat e Char Source #

JsonFormat for Char, mapping to a JSON string.

scientificJsonFormat :: JsonFormat e Scientific Source #

JsonFormat for Scientific, mapping to a JSON number.

Warning: some JSON parsing libraries do not accept the scientific number notation even though it's part of the JSON standard, and this format uses scientificBuilder transitively which encodes very small (and large ( 9,999,999.0) fractional numbers using scientific notation.

realFloatToJson :: RealFloat a => a -> Value Source #

Convert some RealFloat value to Value. Copied from Aeson internals which do not export it.

realFloatJsonFormat :: RealFloat a => JsonFormat e a Source #

Polymorphic JSON format for any type which instances RealFloat. See warning in documentation for scientificJsonFormat about scientific notation.

integralJsonFormat :: Integral a => JsonFormat e a Source #

Polymorphic JSON format for any type which instances Integral.

textJsonFormat :: JsonFormat e Text Source #

JSON format for Text.

nullJsonFormat :: JsonFormat e () Source #

JSON format for '()' which maps to JSON as null.

aesonValueJsonFormat :: JsonFormat e Value Source #

JSON format which does no parsing or encoding.

aesonObjectJsonFormat :: JsonFormat e Object Source #

JSON format for Object which maps to any object in JSON.

aesonArrayJsonFormat :: JsonFormat e Array Source #

JSON format for Array which maps to any array in JSON.