aeson-2.2.3.0: Fast JSON parsing and encoding

Copyright | (c) 2011-2016 Bryan O'Sullivan (c) 2011 MailRank Inc.
License | BSD3
Maintainer | Bryan O'Sullivan <bos@serpentine.com>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Data.Aeson.Types

Contents

- Core JSON types
- Convenience types and functions
- Type conversion
  - Parsing
  - Parser error handling
  - Parsing with paths
  - Encoding
  - Keys for maps
    - Generic keys
  - Liftings to unary and binary type constructors
  - Generic JSON classes
- Inspecting ``Value`s`
- Generic and TH encoding configuration
  - Options fields
  - Options utilities
  - Options for object keys
- Parsing exceptions
- Parsing context

Description

Types for working with JSON data.

Synopsis

- data Value
  - = Object !Object
  - | Array !Array
  - | String !Text
  - | Number !Scientific
  - | Bool !Bool
  - | Null
- data Key
- type Encoding = Encoding' Value
- unsafeToEncoding :: Builder -> Encoding' a
- fromEncoding :: Encoding' tag -> Builder
- data Series
- type Array = Vector Value
- emptyArray :: Value
- type Pair = (Key, Value)
- type Object = KeyMap Value
- emptyObject :: Value
- newtype DotNetTime = DotNetTime {
  - fromDotNetTime :: UTCTime
  }
- typeMismatch :: String -> Value -> Parser a
- unexpected :: Value -> Parser a
- data Parser a
- data Result a
  - = Error String
  - | Success a
- class FromJSON a where
  - parseJSON :: Value -> Parser a
  - parseJSONList :: Value -> Parser [a]
  - omittedField :: Maybe a
- fromJSON :: FromJSON a => Value -> Result a
- parse :: (a -> Parser b) -> a -> Result b
- parseEither :: (a -> Parser b) -> a -> Either String b
- parseMaybe :: (a -> Parser b) -> a -> Maybe b
- parseFail :: String -> Parser a
- modifyFailure :: (String -> String) -> Parser a -> Parser a
- prependFailure :: String -> Parser a -> Parser a
- parserThrowError :: JSONPath -> String -> Parser a
- parserCatchError :: Parser a -> (JSONPath -> String -> Parser a) -> Parser a
- data IResult a
  - = IError JSONPath String
  - | ISuccess a
- ifromJSON :: FromJSON a => Value -> IResult a
- iparse :: (a -> Parser b) -> a -> IResult b
- iparseEither :: (a -> Parser b) -> a -> Either (JSONPath, String) b
- class ToJSON a where
  - toJSON :: a -> Value
  - toEncoding :: a -> Encoding
  - toJSONList :: [a] -> Value
  - toEncodingList :: [a] -> Encoding
  - omitField :: a -> Bool
- class KeyValue e kv | kv -> e where
  - (.=) :: ToJSON v => Key -> v -> kv
  - explicitToField :: (v -> e) -> Key -> v -> kv
- class KeyValue e kv => KeyValueOmit e kv | kv -> e where
  - (.?=) :: ToJSON v => Key -> v -> kv
  - explicitToFieldOmit :: (v -> Bool) -> (v -> e) -> Key -> v -> kv
- class ToJSONKey a where
  - toJSONKey :: ToJSONKeyFunction a
  - toJSONKeyList :: ToJSONKeyFunction [a]
- data ToJSONKeyFunction a
  - = ToJSONKeyText !(a -> Key) !(a -> Encoding' Key)
  - | ToJSONKeyValue !(a -> Value) !(a -> Encoding)
- toJSONKeyText :: (a -> Text) -> ToJSONKeyFunction a
- toJSONKeyKey :: (a -> Key) -> ToJSONKeyFunction a
- contramapToJSONKeyFunction :: (b -> a) -> ToJSONKeyFunction a -> ToJSONKeyFunction b
- class FromJSONKey a where
  - fromJSONKey :: FromJSONKeyFunction a
  - fromJSONKeyList :: FromJSONKeyFunction [a]
- data FromJSONKeyFunction a where
  - FromJSONKeyCoerce :: forall a. Coercible Text a => FromJSONKeyFunction a
  - FromJSONKeyText :: forall a. !(Text -> a) -> FromJSONKeyFunction a
  - FromJSONKeyTextParser :: forall a. !(Text -> Parser a) -> FromJSONKeyFunction a
  - FromJSONKeyValue :: forall a. !(Value -> Parser a) -> FromJSONKeyFunction a
- fromJSONKeyCoerce :: Coercible Text a => FromJSONKeyFunction a
- coerceFromJSONKeyFunction :: Coercible a b => FromJSONKeyFunction a -> FromJSONKeyFunction b
- mapFromJSONKeyFunction :: (a -> b) -> FromJSONKeyFunction a -> FromJSONKeyFunction b
- class GetConName f => GToJSONKey (f :: k -> Type)
- genericToJSONKey :: (Generic a, GToJSONKey (Rep a)) => JSONKeyOptions -> ToJSONKeyFunction a
- class (ConstructorNames f, SumFromString f) => GFromJSONKey (f :: Type -> Type)
- genericFromJSONKey :: (Generic a, GFromJSONKey (Rep a)) => JSONKeyOptions -> FromJSONKeyFunction a
- class FromJSON1 (f :: Type -> Type) where
  - liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)
  - liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a]
  - liftOmittedField :: Maybe a -> Maybe (f a)
- parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a)
- omittedField1 :: (FromJSON1 f, FromJSON a) => Maybe (f a)
- class FromJSON2 (f :: Type -> Type -> Type) where
  - liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b)
  - liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b]
  - liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (f a b)
- parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b)
- omittedField2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Maybe (f a b)
- class ToJSON1 (f :: Type -> Type) where
  - liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value
  - liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [f a] -> Value
  - liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding
  - liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding
  - liftOmitField :: (a -> Bool) -> f a -> Bool
- toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value
- toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding
- omitField1 :: (ToJSON1 f, ToJSON a) => f a -> Bool
- class ToJSON2 (f :: Type -> Type -> Type) where
  - liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value
  - liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value
  - liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding
  - liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding
  - liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> f a b -> Bool
- toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value
- toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding
- omitField2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Bool
- class GFromJSON arity (f :: Type -> Type)
- data FromArgs arity a
- type GToJSON = GToJSON' Value
- type GToEncoding = GToJSON' Encoding
- class GToJSON' enc arity (f :: Type -> Type)
- data ToArgs res arity a
- data Zero
- data One
- genericToJSON :: (Generic a, GToJSON' Value Zero (Rep a)) => Options -> a -> Value
- genericLiftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value
- genericToEncoding :: (Generic a, GToJSON' Encoding Zero (Rep a)) => Options -> a -> Encoding
- genericLiftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding
- genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a
- genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)
- withObject :: String -> (Object -> Parser a) -> Value -> Parser a
- withText :: String -> (Text -> Parser a) -> Value -> Parser a
- withArray :: String -> (Array -> Parser a) -> Value -> Parser a
- withScientific :: String -> (Scientific -> Parser a) -> Value -> Parser a
- withBool :: String -> (Bool -> Parser a) -> Value -> Parser a
- withEmbeddedJSON :: String -> (Value -> Parser a) -> Value -> Parser a
- pairs :: Series -> Encoding
- foldable :: (Foldable t, ToJSON a) => t a -> Encoding
- (.:) :: FromJSON a => Object -> Key -> Parser a
- (.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a)
- (.:!) :: FromJSON a => Object -> Key -> Parser (Maybe a)
- (.!=) :: Parser (Maybe a) -> a -> Parser a
- (.:?=) :: FromJSON a => Object -> Key -> Parser a
- (.:!=) :: FromJSON a => Object -> Key -> Parser a
- object :: [Pair] -> Value
- parseField :: FromJSON a => Object -> Key -> Parser a
- parseFieldMaybe :: FromJSON a => Object -> Key -> Parser (Maybe a)
- parseFieldMaybe' :: FromJSON a => Object -> Key -> Parser (Maybe a)
- parseFieldOmit :: FromJSON a => Object -> Key -> Parser a
- parseFieldOmit' :: FromJSON a => Object -> Key -> Parser a
- explicitParseField :: (Value -> Parser a) -> Object -> Key -> Parser a
- explicitParseFieldMaybe :: (Value -> Parser a) -> Object -> Key -> Parser (Maybe a)
- explicitParseFieldMaybe' :: (Value -> Parser a) -> Object -> Key -> Parser (Maybe a)
- explicitParseFieldOmit :: Maybe a -> (Value -> Parser a) -> Object -> Key -> Parser a
- explicitParseFieldOmit' :: Maybe a -> (Value -> Parser a) -> Object -> Key -> Parser a
- listEncoding :: (a -> Encoding) -> [a] -> Encoding
- listValue :: (a -> Value) -> [a] -> Value
- listParser :: (Value -> Parser a) -> Value -> Parser [a]
- data Options
- fieldLabelModifier :: Options -> String -> String
- constructorTagModifier :: Options -> String -> String
- allNullaryToStringTag :: Options -> Bool
- omitNothingFields :: Options -> Bool
- allowOmittedFields :: Options -> Bool
- sumEncoding :: Options -> SumEncoding
- unwrapUnaryRecords :: Options -> Bool
- tagSingleConstructors :: Options -> Bool
- rejectUnknownFields :: Options -> Bool
- data SumEncoding
  - = TaggedObject {
    - tagFieldName :: String
    - contentsFieldName :: String
    }
  - | UntaggedValue
  - | ObjectWithSingleField
  - | TwoElemArray
- camelTo :: Char -> String -> String
- camelTo2 :: Char -> String -> String
- defaultOptions :: Options
- defaultTaggedObject :: SumEncoding
- data JSONKeyOptions
- keyModifier :: JSONKeyOptions -> String -> String
- defaultJSONKeyOptions :: JSONKeyOptions
- newtype AesonException = AesonException String
- (<?>) :: Parser a -> JSONPathElement -> Parser a
- type JSONPath = [JSONPathElement]
- data JSONPathElement
  - = Key Key
  - | Index !Int
- formatPath :: JSONPath -> String
- formatRelativePath :: JSONPath -> String
- formatError :: JSONPath -> String -> String

# Core JSON types

data Value #

A JSON value represented as a Haskell value.

Constructors

Object !Object |
Array !Array |
String !Text |
Number !Scientific |
Bool !Bool |
Null |

#### Instances

Instances details

Arbitrary Value # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Types.Internal Methods arbitrary :: Gen Value # shrink :: Value -> [Value] #
CoArbitrary Value # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Types.Internal Methods coarbitrary :: Value -> Gen b -> Gen b #
Function Value # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Types.Internal Methods function :: (Value -> b) -> Value :-> b #
FromJSON Value # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Value # parseJSONList :: Value -> Parser [Value] # omittedField :: Maybe Value #
ToJSON Value # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Value -> Value # toEncoding :: Value -> Encoding # toJSONList :: [Value] -> Value # toEncodingList :: [Value] -> Encoding # omitField :: Value -> Bool #
NFData Value # |
Instance details Defined in Data.Aeson.Types.Internal Methods rnf :: Value -> () #
Data Value # |

Instance details

Defined in Data.Aeson.Types.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Value -> c Value #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Value #

toConstr :: Value -> Constr #

dataTypeOf :: Value -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Value) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value) #

gmapT :: (forall b. Data b => b -> b) -> Value -> Value #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r #

gmapQ :: (forall d. Data d => d -> u) -> Value -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Value -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Value -> m Value #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value #

IsString Value # |
Instance details Defined in Data.Aeson.Types.Internal Methods fromString :: String -> Value #
Generic Value # |

Instance details

Defined in Data.Aeson.Types.Internal

Associated Types

type Rep Value |

Instance details

Defined in Data.Aeson.Types.Internal

type Rep Value = D1 ('MetaData "Value" "Data.Aeson.Types.Internal" "aeson-2.2.3.0-7XnCskwqBum1iz93aA1K0B" 'False) ((C1 ('MetaCons "Object" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Object)) :+: (C1 ('MetaCons "Array" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Array)) :+: C1 ('MetaCons "String" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) :+: (C1 ('MetaCons "Number" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scientific)) :+: (C1 ('MetaCons "Bool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: C1 ('MetaCons "Null" 'PrefixI 'False) (U1 :: Type -> Type))))

Methods

from :: Value -> Rep Value x #

to :: Rep Value x -> Value #

Read Value # |
Instance details Defined in Data.Aeson.Types.Internal Methods readsPrec :: Int -> ReadS Value # readList :: ReadS [Value] # readPrec :: ReadPrec Value # readListPrec :: ReadPrec [Value] #

Show Value #

Since version 1.5.6.0 version object values are printed in lexicographic key order

    >>> toJSON $ H.fromList [("a", True), ("z", False)]
    Object (fromList [("a",Bool True),("z",Bool False)])

    >>> toJSON $ H.fromList [("z", False), ("a", True)]
    Object (fromList [("a",Bool True),("z",Bool False)])

Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> Value -> ShowS # show :: Value -> String # showList :: [Value] -> ShowS #
Eq Value # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: Value -> Value -> Bool # (/=) :: Value -> Value -> Bool #
Ord Value # | The ordering is total, consistent with `Eq` instance. However, nothing else about the ordering is specified, and it may change from environment to environment and version to version of either this package or its dependencies (`hashable` and 'unordered-containers'). Since: 1.5.2.0
Instance details Defined in Data.Aeson.Types.Internal Methods compare :: Value -> Value -> Ordering # (<) :: Value -> Value -> Bool # (<=) :: Value -> Value -> Bool # (>) :: Value -> Value -> Bool # (>=) :: Value -> Value -> Bool # max :: Value -> Value -> Value # min :: Value -> Value -> Value #
Hashable Value # |
Instance details Defined in Data.Aeson.Types.Internal Methods hashWithSalt :: Int -> Value -> Int # hash :: Value -> Int #
KeyValue Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> Series # explicitToField :: (v -> Encoding) -> Key -> v -> Series #
KeyValueOmit Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> Series # explicitToFieldOmit :: (v -> Bool) -> (v -> Encoding) -> Key -> v -> Series #
Lift Value # | Since: 0.11.0.0
Instance details Defined in Data.Aeson.Types.Internal Methods lift :: Quote m => Value -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Value -> Code m Value #
GToJSON' Encoding arity (U1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a -> U1 a -> Encoding
GToJSON' Encoding arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a -> V1 a -> Encoding
GToJSON' Value arity (U1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a -> U1 a -> Value
GToJSON' Value arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a -> V1 a -> Value
ToJSON1 f => GToJSON' Encoding One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> Rec1 f a -> Encoding
ToJSON1 f => GToJSON' Value One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> Rec1 f a -> Value
(EncodeProduct arity a, EncodeProduct arity b) => GToJSON' Encoding arity (a :*: b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a0 -> (a :*: b) a0 -> Encoding
ToJSON a => GToJSON' Encoding arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a0 -> K1 i a a0 -> Encoding
(WriteProduct arity a, WriteProduct arity b, ProductSize a, ProductSize b) => GToJSON' Value arity (a :*: b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a0 -> (a :*: b) a0 -> Value
ToJSON a => GToJSON' Value arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a0 -> K1 i a a0 -> Value
(ToJSON1 f, GToJSON' Encoding One g) => GToJSON' Encoding One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> (f :.: g) a -> Encoding
(ToJSON1 f, GToJSON' Value One g) => GToJSON' Value One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> (f :.: g) a -> Value
value ~ Value => KeyValue Value (KeyMap value) # | Constructs a singleton `KeyMap`. For calling functions that demand an `Object` for constructing objects. To be used in conjunction with `mconcat`. Prefer to use `object` where possible.
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> KeyMap value # explicitToField :: (v -> Value) -> Key -> v -> KeyMap value #
value ~ Value => KeyValueOmit Value (KeyMap value) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> KeyMap value # explicitToFieldOmit :: (v -> Bool) -> (v -> Value) -> Key -> v -> KeyMap value #
(key ~ Key, value ~ Value) => KeyValue Value (key, value) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> (key, value) # explicitToField :: (v -> Value) -> Key -> v -> (key, value) #
type Rep Value # |

Instance details

Defined in Data.Aeson.Types.Internal

type Rep Value = D1 ('MetaData "Value" "Data.Aeson.Types.Internal" "aeson-2.2.3.0-7XnCskwqBum1iz93aA1K0B" 'False) ((C1 ('MetaCons "Object" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Object)) :+: (C1 ('MetaCons "Array" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Array)) :+: C1 ('MetaCons "String" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) :+: (C1 ('MetaCons "Number" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Scientific)) :+: (C1 ('MetaCons "Bool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)) :+: C1 ('MetaCons "Null" 'PrefixI 'False) (U1 :: Type -> Type))))

data Key #

#### Instances

Instances details

Arbitrary Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods arbitrary :: Gen Key # shrink :: Key -> [Key] #
CoArbitrary Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods coarbitrary :: Key -> Gen b -> Gen b #
Function Key # | Since: 2.0.3.0
Instance details Defined in Data.Aeson.Key Methods function :: (Key -> b) -> Key :-> b #
FromJSON Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Key # parseJSONList :: Value -> Parser [Key] # omittedField :: Maybe Key #
FromJSONKey Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Key # fromJSONKeyList :: FromJSONKeyFunction [Key] #
ToJSON Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Key -> Value # toEncoding :: Key -> Encoding # toJSONList :: [Key] -> Value # toEncodingList :: [Key] -> Encoding # omitField :: Key -> Bool #
ToJSONKey Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Key # toJSONKeyList :: ToJSONKeyFunction [Key] #
NFData Key # |
Instance details Defined in Data.Aeson.Key Methods rnf :: Key -> () #
Monoid Key # |
Instance details Defined in Data.Aeson.Key Methods mempty :: Key # mappend :: Key -> Key -> Key # mconcat :: [Key] -> Key #
Semigroup Key # |
Instance details Defined in Data.Aeson.Key Methods (<>) :: Key -> Key -> Key # sconcat :: NonEmpty Key -> Key # stimes :: Integral b => b -> Key -> Key #
Data Key # |

Instance details

Defined in Data.Aeson.Key

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Key -> c Key #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Key #

toConstr :: Key -> Constr #

dataTypeOf :: Key -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Key) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Key) #

gmapT :: (forall b. Data b => b -> b) -> Key -> Key #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r #

gmapQ :: (forall d. Data d => d -> u) -> Key -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Key -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Key -> m Key #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key #

IsString Key # |
Instance details Defined in Data.Aeson.Key Methods fromString :: String -> Key #
Read Key # |
Instance details Defined in Data.Aeson.Key Methods readsPrec :: Int -> ReadS Key # readList :: ReadS [Key] # readPrec :: ReadPrec Key # readListPrec :: ReadPrec [Key] #
Show Key # |
Instance details Defined in Data.Aeson.Key Methods showsPrec :: Int -> Key -> ShowS # show :: Key -> String # showList :: [Key] -> ShowS #
Eq Key # |
Instance details Defined in Data.Aeson.Key Methods (==) :: Key -> Key -> Bool # (/=) :: Key -> Key -> Bool #
Ord Key # |
Instance details Defined in Data.Aeson.Key Methods compare :: Key -> Key -> Ordering # (<) :: Key -> Key -> Bool # (<=) :: Key -> Key -> Bool # (>) :: Key -> Key -> Bool # (>=) :: Key -> Key -> Bool # max :: Key -> Key -> Key # min :: Key -> Key -> Key #
Hashable Key # |
Instance details Defined in Data.Aeson.Key Methods hashWithSalt :: Int -> Key -> Int # hash :: Key -> Int #
FoldableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods ifoldMap :: Monoid m => (Key -> a -> m) -> KeyMap a -> m # ifoldMap' :: Monoid m => (Key -> a -> m) -> KeyMap a -> m # ifoldr :: (Key -> a -> b -> b) -> b -> KeyMap a -> b # ifoldl :: (Key -> b -> a -> b) -> b -> KeyMap a -> b # ifoldr' :: (Key -> a -> b -> b) -> b -> KeyMap a -> b # ifoldl' :: (Key -> b -> a -> b) -> b -> KeyMap a -> b #
FunctorWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods imap :: (Key -> a -> b) -> KeyMap a -> KeyMap b #
TraversableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods itraverse :: Applicative f => (Key -> a -> f b) -> KeyMap a -> f (KeyMap b) #
SemialignWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods ialignWith :: (Key -> These a b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
ZipWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods izipWith :: (Key -> a -> b -> c) -> KeyMap a -> KeyMap b -> KeyMap c #
Lift Key # |
Instance details Defined in Data.Aeson.Key Methods lift :: Quote m => Key -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => Key -> Code m Key #
FilterableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods imapMaybe :: (Key -> a -> Maybe b) -> KeyMap a -> KeyMap b # ifilter :: (Key -> a -> Bool) -> KeyMap a -> KeyMap a #
WitherableWithIndex Key KeyMap # |
Instance details Defined in Data.Aeson.KeyMap Methods iwither :: Applicative f => (Key -> a -> f (Maybe b)) -> KeyMap a -> f (KeyMap b) # iwitherM :: Monad m => (Key -> a -> m (Maybe b)) -> KeyMap a -> m (KeyMap b) # ifilterA :: Applicative f => (Key -> a -> f Bool) -> KeyMap a -> f (KeyMap a) #

type Encoding = Encoding' Value #

Often used synonym for `Encoding'`.

unsafeToEncoding :: Builder -> Encoding' a #

Make Encoding from Builder.

Use with care! You have to make sure that the passed Builder is a valid JSON Encoding!

fromEncoding :: Encoding' tag -> Builder #

Acquire the underlying bytestring builder.

data Series #

A series of values that, when encoded, should be separated by commas. Since 0.11.0.0, the `.=` operator is overloaded to create either `(Text, Value)` or `Series`. You can use Series when encoding directly to a bytestring builder as in the following example:

    toEncoding (Person name age) = pairs ("name" .= name <> "age" .= age)

#### Instances

Instances details

Monoid Series # |
Instance details Defined in Data.Aeson.Encoding.Internal Methods mempty :: Series # mappend :: Series -> Series -> Series # mconcat :: [Series] -> Series #
Semigroup Series # |
Instance details Defined in Data.Aeson.Encoding.Internal Methods (<>) :: Series -> Series -> Series # sconcat :: NonEmpty Series -> Series # stimes :: Integral b => b -> Series -> Series #
KeyValue Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> Series # explicitToField :: (v -> Encoding) -> Key -> v -> Series #
KeyValueOmit Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> Series # explicitToFieldOmit :: (v -> Bool) -> (v -> Encoding) -> Key -> v -> Series #

type Array = Vector Value #

A JSON "array" (sequence).

emptyArray :: Value #

The empty array.

type Pair = (Key, Value) #

A key/value pair for an `Object`.

type Object = KeyMap Value #

A JSON "object" (key/value map).

emptyObject :: Value #

The empty object.

# Convenience types and functions

newtype DotNetTime #

A newtype wrapper for `UTCTime` that uses the same non-standard serialization format as Microsoft .NET, whose System.DateTime type is by default serialized to JSON as in the following example:

    /Date(1302547608878)/

The number represents milliseconds since the Unix epoch.

Constructors

DotNetTime |

Fields

- fromDotNetTime :: UTCTime

  Acquire the underlying value.

#### Instances

Instances details

FromJSON DotNetTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser DotNetTime # parseJSONList :: Value -> Parser [DotNetTime] # omittedField :: Maybe DotNetTime #
ToJSON DotNetTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DotNetTime -> Value # toEncoding :: DotNetTime -> Encoding # toJSONList :: [DotNetTime] -> Value # toEncodingList :: [DotNetTime] -> Encoding # omitField :: DotNetTime -> Bool #
Read DotNetTime # |
Instance details Defined in Data.Aeson.Types.Internal Methods readsPrec :: Int -> ReadS DotNetTime # readList :: ReadS [DotNetTime] # readPrec :: ReadPrec DotNetTime # readListPrec :: ReadPrec [DotNetTime] #
Show DotNetTime # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> DotNetTime -> ShowS # show :: DotNetTime -> String # showList :: [DotNetTime] -> ShowS #
Eq DotNetTime # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: DotNetTime -> DotNetTime -> Bool # (/=) :: DotNetTime -> DotNetTime -> Bool #
Ord DotNetTime # |
Instance details Defined in Data.Aeson.Types.Internal Methods compare :: DotNetTime -> DotNetTime -> Ordering # (<) :: DotNetTime -> DotNetTime -> Bool # (<=) :: DotNetTime -> DotNetTime -> Bool # (>) :: DotNetTime -> DotNetTime -> Bool # (>=) :: DotNetTime -> DotNetTime -> Bool # max :: DotNetTime -> DotNetTime -> DotNetTime # min :: DotNetTime -> DotNetTime -> DotNetTime #
FormatTime DotNetTime # |
Instance details Defined in Data.Aeson.Types.Internal Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> DotNetTime -> String) #

typeMismatch #

Arguments

:: String | The name of the JSON type being parsed (`"Object"`, `"Array"`, `"String"`, `"Number"`, `"Boolean"`, or `"Null"`).
-> Value | The actual value encountered.
-> Parser a |

Fail parsing due to a type mismatch, with a descriptive message.

The following wrappers should generally be preferred: `withObject`, `withArray`, `withText`, `withBool`.

#### Error message example

    typeMismatch "Object" (String "oops")
    -- Error: "expected Object, but encountered String"

unexpected :: Value -> Parser a #

Fail parsing due to a type mismatch, when the expected types are implicit.

#### Error message example

    unexpected (String "oops")
    -- Error: "unexpected String"

# Type conversion

## Parsing

data Parser a #

A JSON parser. N.B. This might not fit your usual understanding of "parser". Instead you might like to think of `Parser` as a "parse result", i.e. a parser to which the input has already been applied.

#### Instances

Instances details

Alternative Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods empty :: Parser a # (<|>) :: Parser a -> Parser a -> Parser a # some :: Parser a -> Parser [a] # many :: Parser a -> Parser [a] #
Applicative Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods pure :: a -> Parser a # (<*>) :: Parser (a -> b) -> Parser a -> Parser b # liftA2 :: (a -> b -> c) -> Parser a -> Parser b -> Parser c # (*>) :: Parser a -> Parser b -> Parser b # (<*) :: Parser a -> Parser b -> Parser a #
Functor Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods fmap :: (a -> b) -> Parser a -> Parser b # (<$) :: a -> Parser b -> Parser a #
Monad Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods (>>=) :: Parser a -> (a -> Parser b) -> Parser b # (>>) :: Parser a -> Parser b -> Parser b # return :: a -> Parser a #
MonadPlus Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods mzero :: Parser a # mplus :: Parser a -> Parser a -> Parser a #
MonadFail Parser # |
Instance details Defined in Data.Aeson.Types.Internal Methods fail :: String -> Parser a #
MonadFix Parser # | Since: 2.1.0.0
Instance details Defined in Data.Aeson.Types.Internal Methods mfix :: (a -> Parser a) -> Parser a #
Monoid (Parser a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods mempty :: Parser a # mappend :: Parser a -> Parser a -> Parser a # mconcat :: [Parser a] -> Parser a #
Semigroup (Parser a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods (<>) :: Parser a -> Parser a -> Parser a # sconcat :: NonEmpty (Parser a) -> Parser a # stimes :: Integral b => b -> Parser a -> Parser a #

data Result a #

The result of running a `Parser`.

Constructors

Error String |
Success a |

#### Instances

Instances details

Alternative Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods empty :: Result a # (<|>) :: Result a -> Result a -> Result a # some :: Result a -> Result [a] # many :: Result a -> Result [a] #
Applicative Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods pure :: a -> Result a # (<*>) :: Result (a -> b) -> Result a -> Result b # liftA2 :: (a -> b -> c) -> Result a -> Result b -> Result c # (*>) :: Result a -> Result b -> Result b # (<*) :: Result a -> Result b -> Result a #
Functor Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods fmap :: (a -> b) -> Result a -> Result b # (<$) :: a -> Result b -> Result a #
Monad Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods (>>=) :: Result a -> (a -> Result b) -> Result b # (>>) :: Result a -> Result b -> Result b # return :: a -> Result a #
MonadPlus Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods mzero :: Result a # mplus :: Result a -> Result a -> Result a #
MonadFail Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods fail :: String -> Result a #
Foldable Result # |

Instance details

Defined in Data.Aeson.Types.Internal

Methods

fold :: Monoid m => Result m -> m #

foldMap :: Monoid m => (a -> m) -> Result a -> m #

foldMap' :: Monoid m => (a -> m) -> Result a -> m #

foldr :: (a -> b -> b) -> b -> Result a -> b #

foldr' :: (a -> b -> b) -> b -> Result a -> b #

foldl :: (b -> a -> b) -> b -> Result a -> b #

foldl' :: (b -> a -> b) -> b -> Result a -> b #

foldr1 :: (a -> a -> a) -> Result a -> a #

foldl1 :: (a -> a -> a) -> Result a -> a #

toList :: Result a -> [a] #

null :: Result a -> Bool #

length :: Result a -> Int #

elem :: Eq a => a -> Result a -> Bool #

maximum :: Ord a => Result a -> a #

minimum :: Ord a => Result a -> a #

sum :: Num a => Result a -> a #

product :: Num a => Result a -> a #

Traversable Result # |
Instance details Defined in Data.Aeson.Types.Internal Methods traverse :: Applicative f => (a -> f b) -> Result a -> f (Result b) # sequenceA :: Applicative f => Result (f a) -> f (Result a) # mapM :: Monad m => (a -> m b) -> Result a -> m (Result b) # sequence :: Monad m => Result (m a) -> m (Result a) #
NFData a => NFData (Result a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods rnf :: Result a -> () #
Monoid (Result a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods mempty :: Result a # mappend :: Result a -> Result a -> Result a # mconcat :: [Result a] -> Result a #
Semigroup (Result a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods (<>) :: Result a -> Result a -> Result a # sconcat :: NonEmpty (Result a) -> Result a # stimes :: Integral b => b -> Result a -> Result a #
Show a => Show (Result a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> Result a -> ShowS # show :: Result a -> String # showList :: [Result a] -> ShowS #
Eq a => Eq (Result a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: Result a -> Result a -> Bool # (/=) :: Result a -> Result a -> Bool #

class FromJSON a where #

A type that can be converted from JSON, with the possibility of failure.

In many cases, you can get the compiler to generate parsing code for you (see below). To begin, let's cover writing an instance by hand.

There are various reasons a conversion could fail. For example, an `Object` could be missing a required key, an `Array` could be of the wrong size, or a value could be of an incompatible type.

The basic ways to signal a failed conversion are as follows:

- `fail` yields a custom error message: it is the recommended way of reporting a failure;
- `empty` (or `mzero`) is uninformative: use it when the error is meant to be caught by some `(`<|>`)`;
- `typeMismatch` can be used to report a failure when the encountered value is not of the expected JSON type; `unexpected` is an appropriate alternative when more than one type may be expected, or to keep the expected type implicit.

`prependFailure` (or `modifyFailure`) add more information to a parser's error messages.

An example type and instance using `typeMismatch` and `prependFailure`:

    -- Allow ourselves to write Text literals.
    {-# LANGUAGE OverloadedStrings #-}

    data Coord = Coord { x :: Double, y :: Double }

    instance FromJSON Coord where
        parseJSON (Object v) = Coord
            <$> v .: "x"
            <*> v .: "y"

        -- We do not expect a non-Object value here.
        -- We could use empty to fail, but typeMismatch
        -- gives a much more informative error message.
        parseJSON invalid    =
            prependFailure "parsing Coord failed, "
                (typeMismatch "Object" invalid)

For this common case of only being concerned with a single type of JSON value, the functions `withObject`, `withScientific`, etc. are provided. Their use is to be preferred when possible, since they are more terse. Using `withObject`, we can rewrite the above instance (assuming the same language extension and data type) as:

    instance FromJSON Coord where
        parseJSON = withObject "Coord" $ \v -> Coord
            <$> v .: "x"
            <*> v .: "y"

Instead of manually writing your `FromJSON` instance, there are two options to do it automatically:

- Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
- The compiler can provide a default generic implementation for `parseJSON`.

To use the second, simply add a `deriving `Generic`` clause to your datatype and declare a `FromJSON` instance for your datatype without giving a definition for `parseJSON`.

For example, the previous example can be simplified to just:

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics

    data Coord = Coord { x :: Double, y :: Double } deriving Generic

    instance FromJSON Coord

or using the DerivingVia extension

    deriving via Generically Coord instance FromJSON Coord

The default implementation will be equivalent to `parseJSON = `genericParseJSON` `defaultOptions``; if you need different options, you can customize the generic decoding by defining:

    customOptions = defaultOptions
                    { fieldLabelModifier = map toUpper
                    }

    instance FromJSON Coord where
        parseJSON = genericParseJSON customOptions

Minimal complete definition

Nothing

Methods

parseJSON :: Value -> Parser a #

default parseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a #

parseJSONList :: Value -> Parser [a] #

omittedField :: Maybe a #

Default value for optional fields. Used by `(`.:?=`)` operator, and Generics and TH deriving with ``allowOmittedFields` = True` (default).

Since: 2.2.0.0

#### Instances

Instances details

FromJSON Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Key # parseJSONList :: Value -> Parser [Key] # omittedField :: Maybe Key #
FromJSON DotNetTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser DotNetTime # parseJSONList :: Value -> Parser [DotNetTime] # omittedField :: Maybe DotNetTime #
FromJSON Value # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Value # parseJSONList :: Value -> Parser [Value] # omittedField :: Maybe Value #
FromJSON IntSet # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser IntSet # parseJSONList :: Value -> Parser [IntSet] # omittedField :: Maybe IntSet #
FromJSON Void # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Void # parseJSONList :: Value -> Parser [Void] # omittedField :: Maybe Void #
FromJSON All # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser All # parseJSONList :: Value -> Parser [All] # omittedField :: Maybe All #
FromJSON Any # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Any # parseJSONList :: Value -> Parser [Any] # omittedField :: Maybe Any #
FromJSON Version # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Version # parseJSONList :: Value -> Parser [Version] # omittedField :: Maybe Version #
FromJSON CTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser CTime # parseJSONList :: Value -> Parser [CTime] # omittedField :: Maybe CTime #
FromJSON Int16 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Int16 # parseJSONList :: Value -> Parser [Int16] # omittedField :: Maybe Int16 #
FromJSON Int32 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Int32 # parseJSONList :: Value -> Parser [Int32] # omittedField :: Maybe Int32 #
FromJSON Int64 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Int64 # parseJSONList :: Value -> Parser [Int64] # omittedField :: Maybe Int64 #
FromJSON Int8 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Int8 # parseJSONList :: Value -> Parser [Int8] # omittedField :: Maybe Int8 #
FromJSON Word16 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Word16 # parseJSONList :: Value -> Parser [Word16] # omittedField :: Maybe Word16 #
FromJSON Word32 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Word32 # parseJSONList :: Value -> Parser [Word32] # omittedField :: Maybe Word32 #
FromJSON Word64 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Word64 # parseJSONList :: Value -> Parser [Word64] # omittedField :: Maybe Word64 #
FromJSON Word8 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Word8 # parseJSONList :: Value -> Parser [Word8] # omittedField :: Maybe Word8 #
FromJSON Ordering # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Ordering # parseJSONList :: Value -> Parser [Ordering] # omittedField :: Maybe Ordering #
FromJSON URI # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser URI # parseJSONList :: Value -> Parser [URI] # omittedField :: Maybe URI #
FromJSON Scientific # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Scientific # parseJSONList :: Value -> Parser [Scientific] # omittedField :: Maybe Scientific #
FromJSON Text # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Text # parseJSONList :: Value -> Parser [Text] # omittedField :: Maybe Text #
FromJSON Text # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Text # parseJSONList :: Value -> Parser [Text] # omittedField :: Maybe Text #
FromJSON ShortText # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser ShortText # parseJSONList :: Value -> Parser [ShortText] # omittedField :: Maybe ShortText #
FromJSON CalendarDiffDays # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser CalendarDiffDays # parseJSONList :: Value -> Parser [CalendarDiffDays] # omittedField :: Maybe CalendarDiffDays #
FromJSON Day # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Day # parseJSONList :: Value -> Parser [Day] # omittedField :: Maybe Day #
FromJSON Month # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Month # parseJSONList :: Value -> Parser [Month] # omittedField :: Maybe Month #
FromJSON Quarter # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Quarter # parseJSONList :: Value -> Parser [Quarter] # omittedField :: Maybe Quarter #
FromJSON QuarterOfYear # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser QuarterOfYear # parseJSONList :: Value -> Parser [QuarterOfYear] # omittedField :: Maybe QuarterOfYear #
FromJSON DayOfWeek # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser DayOfWeek # parseJSONList :: Value -> Parser [DayOfWeek] # omittedField :: Maybe DayOfWeek #
FromJSON DiffTime # | This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype `Scientific` and provide your own instance using `withScientific` if you want to allow larger inputs.
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser DiffTime # parseJSONList :: Value -> Parser [DiffTime] # omittedField :: Maybe DiffTime #
FromJSON NominalDiffTime # | This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype `Scientific` and provide your own instance using `withScientific` if you want to allow larger inputs.
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser NominalDiffTime # parseJSONList :: Value -> Parser [NominalDiffTime] # omittedField :: Maybe NominalDiffTime #
FromJSON SystemTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser SystemTime # parseJSONList :: Value -> Parser [SystemTime] # omittedField :: Maybe SystemTime #
FromJSON UTCTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser UTCTime # parseJSONList :: Value -> Parser [UTCTime] # omittedField :: Maybe UTCTime #
FromJSON CalendarDiffTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser CalendarDiffTime # parseJSONList :: Value -> Parser [CalendarDiffTime] # omittedField :: Maybe CalendarDiffTime #
FromJSON LocalTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser LocalTime # parseJSONList :: Value -> Parser [LocalTime] # omittedField :: Maybe LocalTime #
FromJSON TimeOfDay # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser TimeOfDay # parseJSONList :: Value -> Parser [TimeOfDay] # omittedField :: Maybe TimeOfDay #

FromJSON ZonedTime #

Supported string formats:

`YYYY-MM-DD HH:MMZ` `YYYY-MM-DD HH:MM:SSZ` `YYYY-MM-DD HH:MM:SS.SSSZ`

The first space may instead be a `T`, and the second space is optional. The `Z` represents UTC. The `Z` may be replaced with a time zone offset of the form `+0000` or `-08:00`, where the first two digits are hours, the `:` is optional and the second two digits (also optional) are minutes.

Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser ZonedTime # parseJSONList :: Value -> Parser [ZonedTime] # omittedField :: Maybe ZonedTime #
FromJSON UUID # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser UUID # parseJSONList :: Value -> Parser [UUID] # omittedField :: Maybe UUID #
FromJSON Integer # | This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype `Scientific` and provide your own instance using `withScientific` if you want to allow larger inputs.
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Integer # parseJSONList :: Value -> Parser [Integer] # omittedField :: Maybe Integer #
FromJSON Natural # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Natural # parseJSONList :: Value -> Parser [Natural] # omittedField :: Maybe Natural #
FromJSON () # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser () # parseJSONList :: Value -> Parser [()] # omittedField :: Maybe () #
FromJSON Bool # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Bool # parseJSONList :: Value -> Parser [Bool] # omittedField :: Maybe Bool #
FromJSON Char # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Char # parseJSONList :: Value -> Parser [Char] # omittedField :: Maybe Char #
FromJSON Double # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Double # parseJSONList :: Value -> Parser [Double] # omittedField :: Maybe Double #
FromJSON Float # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Float # parseJSONList :: Value -> Parser [Float] # omittedField :: Maybe Float #
FromJSON Int # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Int # parseJSONList :: Value -> Parser [Int] # omittedField :: Maybe Int #
FromJSON Word # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser Word # parseJSONList :: Value -> Parser [Word] # omittedField :: Maybe Word #
FromJSON v => FromJSON (KeyMap v) # | Since: 2.0.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (KeyMap v) # parseJSONList :: Value -> Parser [KeyMap v] # omittedField :: Maybe (KeyMap v) #
FromJSON a => FromJSON (First a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (First a) # parseJSONList :: Value -> Parser [First a] # omittedField :: Maybe (First a) #
FromJSON a => FromJSON (Last a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Last a) # parseJSONList :: Value -> Parser [Last a] # omittedField :: Maybe (Last a) #
FromJSON a => FromJSON (Max a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Max a) # parseJSONList :: Value -> Parser [Max a] # omittedField :: Maybe (Max a) #
FromJSON a => FromJSON (Min a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Min a) # parseJSONList :: Value -> Parser [Min a] # omittedField :: Maybe (Min a) #
FromJSON a => FromJSON (WrappedMonoid a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (WrappedMonoid a) # parseJSONList :: Value -> Parser [WrappedMonoid a] # omittedField :: Maybe (WrappedMonoid a) #
FromJSON a => FromJSON (IntMap a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (IntMap a) # parseJSONList :: Value -> Parser [IntMap a] # omittedField :: Maybe (IntMap a) #
FromJSON a => FromJSON (Seq a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Seq a) # parseJSONList :: Value -> Parser [Seq a] # omittedField :: Maybe (Seq a) #
(Ord a, FromJSON a) => FromJSON (Set a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Set a) # parseJSONList :: Value -> Parser [Set a] # omittedField :: Maybe (Set a) #
FromJSON v => FromJSON (Tree v) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Tree v) # parseJSONList :: Value -> Parser [Tree v] # omittedField :: Maybe (Tree v) #
FromJSON1 f => FromJSON (Fix f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Fix f) # parseJSONList :: Value -> Parser [Fix f] # omittedField :: Maybe (Fix f) #
(FromJSON1 f, Functor f) => FromJSON (Mu f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Mu f) # parseJSONList :: Value -> Parser [Mu f] # omittedField :: Maybe (Mu f) #
(FromJSON1 f, Functor f) => FromJSON (Nu f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Nu f) # parseJSONList :: Value -> Parser [Nu f] # omittedField :: Maybe (Nu f) #
FromJSON a => FromJSON (DNonEmpty a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (DNonEmpty a) # parseJSONList :: Value -> Parser [DNonEmpty a] # omittedField :: Maybe (DNonEmpty a) #
FromJSON a => FromJSON (DList a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (DList a) # parseJSONList :: Value -> Parser [DList a] # omittedField :: Maybe (DList a) #
FromJSON a => FromJSON (NonEmpty a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (NonEmpty a) # parseJSONList :: Value -> Parser [NonEmpty a] # omittedField :: Maybe (NonEmpty a) #
FromJSON a => FromJSON (Identity a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Identity a) # parseJSONList :: Value -> Parser [Identity a] # omittedField :: Maybe (Identity a) #
FromJSON a => FromJSON (First a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (First a) # parseJSONList :: Value -> Parser [First a] # omittedField :: Maybe (First a) #
FromJSON a => FromJSON (Last a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Last a) # parseJSONList :: Value -> Parser [Last a] # omittedField :: Maybe (Last a) #
FromJSON a => FromJSON (Down a) # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Down a) # parseJSONList :: Value -> Parser [Down a] # omittedField :: Maybe (Down a) #
FromJSON a => FromJSON (Dual a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Dual a) # parseJSONList :: Value -> Parser [Dual a] # omittedField :: Maybe (Dual a) #
FromJSON a => FromJSON (Product a) # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Product a) # parseJSONList :: Value -> Parser [Product a] # omittedField :: Maybe (Product a) #
FromJSON a => FromJSON (Sum a) # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Sum a) # parseJSONList :: Value -> Parser [Sum a] # omittedField :: Maybe (Sum a) #
(Generic a, GFromJSON Zero (Rep a)) => FromJSON (Generically a) # | Since: 2.1.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Generically a) # parseJSONList :: Value -> Parser [Generically a] # omittedField :: Maybe (Generically a) #
(FromJSON a, Integral a) => FromJSON (Ratio a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Ratio a) # parseJSONList :: Value -> Parser [Ratio a] # omittedField :: Maybe (Ratio a) #
FromJSON a => FromJSON (Array a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Array a) # parseJSONList :: Value -> Parser [Array a] # omittedField :: Maybe (Array a) #
(Prim a, FromJSON a) => FromJSON (PrimArray a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (PrimArray a) # parseJSONList :: Value -> Parser [PrimArray a] # omittedField :: Maybe (PrimArray a) #
FromJSON a => FromJSON (SmallArray a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (SmallArray a) # parseJSONList :: Value -> Parser [SmallArray a] # omittedField :: Maybe (SmallArray a) #
FromJSON a => FromJSON (Maybe a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Maybe a) # parseJSONList :: Value -> Parser [Maybe a] # omittedField :: Maybe (Maybe a) #
(Eq a, Hashable a, FromJSON a) => FromJSON (HashSet a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (HashSet a) # parseJSONList :: Value -> Parser [HashSet a] # omittedField :: Maybe (HashSet a) #
FromJSON a => FromJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Vector a) # parseJSONList :: Value -> Parser [Vector a] # omittedField :: Maybe (Vector a) #
(Prim a, FromJSON a) => FromJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Vector a) # parseJSONList :: Value -> Parser [Vector a] # omittedField :: Maybe (Vector a) #
(Storable a, FromJSON a) => FromJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Vector a) # parseJSONList :: Value -> Parser [Vector a] # omittedField :: Maybe (Vector a) #
(Vector Vector a, FromJSON a) => FromJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Vector a) # parseJSONList :: Value -> Parser [Vector a] # omittedField :: Maybe (Vector a) #
FromJSON a => FromJSON (Maybe a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Maybe a) # parseJSONList :: Value -> Parser [Maybe a] # omittedField :: Maybe (Maybe a) #
FromJSON a => FromJSON (Solo a) # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Solo a) # parseJSONList :: Value -> Parser [Solo a] # omittedField :: Maybe (Solo a) #
FromJSON a => FromJSON [a] # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser [a] # parseJSONList :: Value -> Parser [[a]] # omittedField :: Maybe [a] #
HasResolution a => FromJSON (Fixed a) # | This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype `Scientific` and provide your own instance using `withScientific` if you want to allow larger inputs.
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Fixed a) # parseJSONList :: Value -> Parser [Fixed a] # omittedField :: Maybe (Fixed a) #
(FromJSONKey k, Ord k, FromJSON v) => FromJSON (Map k v) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Map k v) # parseJSONList :: Value -> Parser [Map k v] # omittedField :: Maybe (Map k v) #
(FromJSON a, FromJSON b) => FromJSON (Either a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Either a b) # parseJSONList :: Value -> Parser [Either a b] # omittedField :: Maybe (Either a b) #
FromJSON (Proxy a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Proxy a) # parseJSONList :: Value -> Parser [Proxy a] # omittedField :: Maybe (Proxy a) #
(FromJSON a, FromJSON b) => FromJSON (Either a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Either a b) # parseJSONList :: Value -> Parser [Either a b] # omittedField :: Maybe (Either a b) #
(FromJSON a, FromJSON b) => FromJSON (These a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (These a b) # parseJSONList :: Value -> Parser [These a b] # omittedField :: Maybe (These a b) #
(FromJSON a, FromJSON b) => FromJSON (Pair a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Pair a b) # parseJSONList :: Value -> Parser [Pair a b] # omittedField :: Maybe (Pair a b) #
(FromJSON a, FromJSON b) => FromJSON (These a b) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (These a b) # parseJSONList :: Value -> Parser [These a b] # omittedField :: Maybe (These a b) #
(FromJSON v, FromJSONKey k, Eq k, Hashable k) => FromJSON (HashMap k v) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (HashMap k v) # parseJSONList :: Value -> Parser [HashMap k v] # omittedField :: Maybe (HashMap k v) #
(FromJSON a, FromJSON b) => FromJSON (a, b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b) # parseJSONList :: Value -> Parser [(a, b)] # omittedField :: Maybe (a, b) #
FromJSON a => FromJSON (Const a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Const a b) # parseJSONList :: Value -> Parser [Const a b] # omittedField :: Maybe (Const a b) #
FromJSON b => FromJSON (Tagged a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Tagged a b) # parseJSONList :: Value -> Parser [Tagged a b] # omittedField :: Maybe (Tagged a b) #
(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (These1 f g a) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (These1 f g a) # parseJSONList :: Value -> Parser [These1 f g a] # omittedField :: Maybe (These1 f g a) #
(FromJSON a, FromJSON b, FromJSON c) => FromJSON (a, b, c) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c) # parseJSONList :: Value -> Parser [(a, b, c)] # omittedField :: Maybe (a, b, c) #
(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Product f g a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Product f g a) # parseJSONList :: Value -> Parser [Product f g a] # omittedField :: Maybe (Product f g a) #
(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Sum f g a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Sum f g a) # parseJSONList :: Value -> Parser [Sum f g a] # omittedField :: Maybe (Sum f g a) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d) => FromJSON (a, b, c, d) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d) # parseJSONList :: Value -> Parser [(a, b, c, d)] # omittedField :: Maybe (a, b, c, d) #
(FromJSON1 f, FromJSON1 g, FromJSON a) => FromJSON (Compose f g a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (Compose f g a) # parseJSONList :: Value -> Parser [Compose f g a] # omittedField :: Maybe (Compose f g a) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e) => FromJSON (a, b, c, d, e) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e) # parseJSONList :: Value -> Parser [(a, b, c, d, e)] # omittedField :: Maybe (a, b, c, d, e) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f) => FromJSON (a, b, c, d, e, f) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f)] # omittedField :: Maybe (a, b, c, d, e, f) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g) => FromJSON (a, b, c, d, e, f, g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g)] # omittedField :: Maybe (a, b, c, d, e, f, g) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h) => FromJSON (a, b, c, d, e, f, g, h) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h)] # omittedField :: Maybe (a, b, c, d, e, f, g, h) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i) => FromJSON (a, b, c, d, e, f, g, h, i) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j) => FromJSON (a, b, c, d, e, f, g, h, i, j) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k) => FromJSON (a, b, c, d, e, f, g, h, i, j, k) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m, FromJSON n) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, n) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m, FromJSON n, FromJSON o) => FromJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods parseJSON :: Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # parseJSONList :: Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] # omittedField :: Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) #

fromJSON :: FromJSON a => Value -> Result a #

Convert a value from JSON, failing if the types do not match.

parse :: (a -> Parser b) -> a -> Result b #

Run a `Parser`.

parseEither :: (a -> Parser b) -> a -> Either String b #

Run a `Parser` with an `Either` result type. If the parse fails, the `Left` payload will contain an error message.

parseMaybe :: (a -> Parser b) -> a -> Maybe b #

Run a `Parser` with a `Maybe` result type.

parseFail :: String -> Parser a #

Raise a parsing failure with some custom message.

## Parser error handling

modifyFailure :: (String -> String) -> Parser a -> Parser a #

If the inner `Parser` failed, modify the failure message using the provided function. This allows you to create more descriptive error messages. For example:

    parseJSON (Object o) = modifyFailure
        ("Parsing of the Foo value failed: " ++)
        (Foo <$> o .: "someField")

Since 0.6.2.0

prependFailure :: String -> Parser a -> Parser a #

If the inner `Parser` failed, prepend the given string to the failure message.

    prependFailure s = modifyFailure (s ++)

parserThrowError :: JSONPath -> String -> Parser a #

Throw a parser error with an additional path.

Since: 1.2.1.0

parserCatchError :: Parser a -> (JSONPath -> String -> Parser a) -> Parser a #

A handler function to handle previous errors and return to normal execution.

Since: 1.2.1.0

## Parsing with paths

data IResult a #

The internal result of running a `Parser`.

Constructors

IError JSONPath String |
ISuccess a |

#### Instances

Instances details

Alternative IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods empty :: IResult a # (<|>) :: IResult a -> IResult a -> IResult a # some :: IResult a -> IResult [a] # many :: IResult a -> IResult [a] #
Applicative IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods pure :: a -> IResult a # (<*>) :: IResult (a -> b) -> IResult a -> IResult b # liftA2 :: (a -> b -> c) -> IResult a -> IResult b -> IResult c # (*>) :: IResult a -> IResult b -> IResult b # (<*) :: IResult a -> IResult b -> IResult a #
Functor IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods fmap :: (a -> b) -> IResult a -> IResult b # (<$) :: a -> IResult b -> IResult a #
Monad IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods (>>=) :: IResult a -> (a -> IResult b) -> IResult b # (>>) :: IResult a -> IResult b -> IResult b # return :: a -> IResult a #
MonadPlus IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods mzero :: IResult a # mplus :: IResult a -> IResult a -> IResult a #
MonadFail IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods fail :: String -> IResult a #
Foldable IResult # |

Instance details

Defined in Data.Aeson.Types.Internal

Methods

fold :: Monoid m => IResult m -> m #

foldMap :: Monoid m => (a -> m) -> IResult a -> m #

foldMap' :: Monoid m => (a -> m) -> IResult a -> m #

foldr :: (a -> b -> b) -> b -> IResult a -> b #

foldr' :: (a -> b -> b) -> b -> IResult a -> b #

foldl :: (b -> a -> b) -> b -> IResult a -> b #

foldl' :: (b -> a -> b) -> b -> IResult a -> b #

foldr1 :: (a -> a -> a) -> IResult a -> a #

foldl1 :: (a -> a -> a) -> IResult a -> a #

toList :: IResult a -> [a] #

null :: IResult a -> Bool #

length :: IResult a -> Int #

elem :: Eq a => a -> IResult a -> Bool #

maximum :: Ord a => IResult a -> a #

minimum :: Ord a => IResult a -> a #

sum :: Num a => IResult a -> a #

product :: Num a => IResult a -> a #

Traversable IResult # |
Instance details Defined in Data.Aeson.Types.Internal Methods traverse :: Applicative f => (a -> f b) -> IResult a -> f (IResult b) # sequenceA :: Applicative f => IResult (f a) -> f (IResult a) # mapM :: Monad m => (a -> m b) -> IResult a -> m (IResult b) # sequence :: Monad m => IResult (m a) -> m (IResult a) #
NFData a => NFData (IResult a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods rnf :: IResult a -> () #
Monoid (IResult a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods mempty :: IResult a # mappend :: IResult a -> IResult a -> IResult a # mconcat :: [IResult a] -> IResult a #
Semigroup (IResult a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods (<>) :: IResult a -> IResult a -> IResult a # sconcat :: NonEmpty (IResult a) -> IResult a # stimes :: Integral b => b -> IResult a -> IResult a #
Show a => Show (IResult a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> IResult a -> ShowS # show :: IResult a -> String # showList :: [IResult a] -> ShowS #
Eq a => Eq (IResult a) # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: IResult a -> IResult a -> Bool # (/=) :: IResult a -> IResult a -> Bool #

ifromJSON :: FromJSON a => Value -> IResult a #

Convert a value from JSON, failing if the types do not match.

iparse :: (a -> Parser b) -> a -> IResult b #

Run a `Parser`.

iparseEither :: (a -> Parser b) -> a -> Either (JSONPath, String) b #

Run a `Parser` with an `Either` result type. If the parse fails, the `Left` payload will contain an error message and a json path to failed element.

Since: 2.1.0.0

## Encoding

class ToJSON a where #

A type that can be converted to JSON.

Instances in general must specify `toJSON` and should (but don't need to) specify `toEncoding`.

An example type and instance:

    -- Allow ourselves to write Text literals.
    {-# LANGUAGE OverloadedStrings #-}

    data Coord = Coord { x :: Double, y :: Double }

    instance ToJSON Coord where
      toJSON (Coord x y) = object ["x" .= x, "y" .= y]

      toEncoding (Coord x y) = pairs ("x" .= x <> "y" .= y)

Instead of manually writing your `ToJSON` instance, there are two options to do it automatically:

- Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
- The compiler can provide a default generic implementation for `toJSON`.

To use the second, simply add a `deriving `Generic`` clause to your datatype and declare a `ToJSON` instance. If you require nothing other than `defaultOptions`, it is sufficient to write (and this is the only alternative where the default `toJSON` implementation is sufficient):

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics

    data Coord = Coord { x :: Double, y :: Double } deriving Generic

    instance ToJSON Coord where
        toEncoding = genericToEncoding defaultOptions

or more conveniently using the DerivingVia extension

    deriving via Generically Coord instance ToJSON Coord

If on the other hand you wish to customize the generic decoding, you have to implement both methods:

    customOptions = defaultOptions
                    { fieldLabelModifier = map toUpper
                    }

    instance ToJSON Coord where
        toJSON     = genericToJSON customOptions
        toEncoding = genericToEncoding customOptions

Previous versions of this library only had the `toJSON` method. Adding `toEncoding` had two reasons:

1. `toEncoding` is more efficient for the common case that the output of `toJSON` is directly serialized to a `ByteString`. Further, expressing either method in terms of the other would be non-optimal.
2. The choice of defaults allows a smooth transition for existing users: Existing instances that do not define `toEncoding` still compile and have the correct semantics. This is ensured by making the default implementation of `toEncoding` use `toJSON`. This produces correct results, but since it performs an intermediate conversion to a `Value`, it will be less efficient than directly emitting an `Encoding`. (this also means that specifying nothing more than `instance ToJSON Coord` would be sufficient as a generically decoding instance, but there probably exists no good reason to not specify `toEncoding` in new instances.)

Minimal complete definition

Nothing

Methods

toJSON :: a -> Value #

Convert a Haskell value to a JSON-friendly intermediate type.

default toJSON :: (Generic a, GToJSON' Value Zero (Rep a)) => a -> Value #

toEncoding :: a -> Encoding #

Encode a Haskell value as JSON.

The default implementation of this method creates an intermediate `Value` using `toJSON`. This provides source-level compatibility for people upgrading from older versions of this library, but obviously offers no performance advantage.

To benefit from direct encoding, you must provide an implementation for this method. The easiest way to do so is by having your types implement `Generic` using the `DeriveGeneric` extension, and then have GHC generate a method body as follows.

    instance ToJSON Coord where
        toEncoding = genericToEncoding defaultOptions

toJSONList :: [a] -> Value #

toEncodingList :: [a] -> Encoding #

omitField :: a -> Bool #

Defines when it is acceptable to omit a field of this type from a record. Used by `(`.?=`)` operator, and Generics and TH deriving with ``omitNothingFields` = True`.

Since: 2.2.0.0

#### Instances

Instances details

ToJSON Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Key -> Value # toEncoding :: Key -> Encoding # toJSONList :: [Key] -> Value # toEncodingList :: [Key] -> Encoding # omitField :: Key -> Bool #
ToJSON DotNetTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DotNetTime -> Value # toEncoding :: DotNetTime -> Encoding # toJSONList :: [DotNetTime] -> Value # toEncodingList :: [DotNetTime] -> Encoding # omitField :: DotNetTime -> Bool #
ToJSON Value # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Value -> Value # toEncoding :: Value -> Encoding # toJSONList :: [Value] -> Value # toEncodingList :: [Value] -> Encoding # omitField :: Value -> Bool #
ToJSON IntSet # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: IntSet -> Value # toEncoding :: IntSet -> Encoding # toJSONList :: [IntSet] -> Value # toEncodingList :: [IntSet] -> Encoding # omitField :: IntSet -> Bool #
ToJSON Void # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Void -> Value # toEncoding :: Void -> Encoding # toJSONList :: [Void] -> Value # toEncodingList :: [Void] -> Encoding # omitField :: Void -> Bool #
ToJSON All # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: All -> Value # toEncoding :: All -> Encoding # toJSONList :: [All] -> Value # toEncodingList :: [All] -> Encoding # omitField :: All -> Bool #
ToJSON Any # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Any -> Value # toEncoding :: Any -> Encoding # toJSONList :: [Any] -> Value # toEncodingList :: [Any] -> Encoding # omitField :: Any -> Bool #
ToJSON Version # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Version -> Value # toEncoding :: Version -> Encoding # toJSONList :: [Version] -> Value # toEncodingList :: [Version] -> Encoding # omitField :: Version -> Bool #
ToJSON CTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: CTime -> Value # toEncoding :: CTime -> Encoding # toJSONList :: [CTime] -> Value # toEncodingList :: [CTime] -> Encoding # omitField :: CTime -> Bool #
ToJSON Int16 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Int16 -> Value # toEncoding :: Int16 -> Encoding # toJSONList :: [Int16] -> Value # toEncodingList :: [Int16] -> Encoding # omitField :: Int16 -> Bool #
ToJSON Int32 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Int32 -> Value # toEncoding :: Int32 -> Encoding # toJSONList :: [Int32] -> Value # toEncodingList :: [Int32] -> Encoding # omitField :: Int32 -> Bool #
ToJSON Int64 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Int64 -> Value # toEncoding :: Int64 -> Encoding # toJSONList :: [Int64] -> Value # toEncodingList :: [Int64] -> Encoding # omitField :: Int64 -> Bool #
ToJSON Int8 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Int8 -> Value # toEncoding :: Int8 -> Encoding # toJSONList :: [Int8] -> Value # toEncodingList :: [Int8] -> Encoding # omitField :: Int8 -> Bool #
ToJSON Word16 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Word16 -> Value # toEncoding :: Word16 -> Encoding # toJSONList :: [Word16] -> Value # toEncodingList :: [Word16] -> Encoding # omitField :: Word16 -> Bool #
ToJSON Word32 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Word32 -> Value # toEncoding :: Word32 -> Encoding # toJSONList :: [Word32] -> Value # toEncodingList :: [Word32] -> Encoding # omitField :: Word32 -> Bool #
ToJSON Word64 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Word64 -> Value # toEncoding :: Word64 -> Encoding # toJSONList :: [Word64] -> Value # toEncodingList :: [Word64] -> Encoding # omitField :: Word64 -> Bool #
ToJSON Word8 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Word8 -> Value # toEncoding :: Word8 -> Encoding # toJSONList :: [Word8] -> Value # toEncodingList :: [Word8] -> Encoding # omitField :: Word8 -> Bool #
ToJSON Ordering # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Ordering -> Value # toEncoding :: Ordering -> Encoding # toJSONList :: [Ordering] -> Value # toEncodingList :: [Ordering] -> Encoding # omitField :: Ordering -> Bool #
ToJSON URI # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: URI -> Value # toEncoding :: URI -> Encoding # toJSONList :: [URI] -> Value # toEncodingList :: [URI] -> Encoding # omitField :: URI -> Bool #
ToJSON Scientific # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Scientific -> Value # toEncoding :: Scientific -> Encoding # toJSONList :: [Scientific] -> Value # toEncodingList :: [Scientific] -> Encoding # omitField :: Scientific -> Bool #
ToJSON Text # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Text -> Value # toEncoding :: Text -> Encoding # toJSONList :: [Text] -> Value # toEncodingList :: [Text] -> Encoding # omitField :: Text -> Bool #
ToJSON Text # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Text -> Value # toEncoding :: Text -> Encoding # toJSONList :: [Text] -> Value # toEncodingList :: [Text] -> Encoding # omitField :: Text -> Bool #
ToJSON ShortText # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: ShortText -> Value # toEncoding :: ShortText -> Encoding # toJSONList :: [ShortText] -> Value # toEncodingList :: [ShortText] -> Encoding # omitField :: ShortText -> Bool #
ToJSON CalendarDiffDays # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: CalendarDiffDays -> Value # toEncoding :: CalendarDiffDays -> Encoding # toJSONList :: [CalendarDiffDays] -> Value # toEncodingList :: [CalendarDiffDays] -> Encoding # omitField :: CalendarDiffDays -> Bool #
ToJSON Day # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Day -> Value # toEncoding :: Day -> Encoding # toJSONList :: [Day] -> Value # toEncodingList :: [Day] -> Encoding # omitField :: Day -> Bool #
ToJSON Month # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Month -> Value # toEncoding :: Month -> Encoding # toJSONList :: [Month] -> Value # toEncodingList :: [Month] -> Encoding # omitField :: Month -> Bool #
ToJSON Quarter # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Quarter -> Value # toEncoding :: Quarter -> Encoding # toJSONList :: [Quarter] -> Value # toEncodingList :: [Quarter] -> Encoding # omitField :: Quarter -> Bool #
ToJSON QuarterOfYear # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: QuarterOfYear -> Value # toEncoding :: QuarterOfYear -> Encoding # toJSONList :: [QuarterOfYear] -> Value # toEncodingList :: [QuarterOfYear] -> Encoding # omitField :: QuarterOfYear -> Bool #
ToJSON DayOfWeek # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DayOfWeek -> Value # toEncoding :: DayOfWeek -> Encoding # toJSONList :: [DayOfWeek] -> Value # toEncodingList :: [DayOfWeek] -> Encoding # omitField :: DayOfWeek -> Bool #
ToJSON DiffTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DiffTime -> Value # toEncoding :: DiffTime -> Encoding # toJSONList :: [DiffTime] -> Value # toEncodingList :: [DiffTime] -> Encoding # omitField :: DiffTime -> Bool #
ToJSON NominalDiffTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: NominalDiffTime -> Value # toEncoding :: NominalDiffTime -> Encoding # toJSONList :: [NominalDiffTime] -> Value # toEncodingList :: [NominalDiffTime] -> Encoding # omitField :: NominalDiffTime -> Bool #
ToJSON SystemTime # | Encoded as number
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: SystemTime -> Value # toEncoding :: SystemTime -> Encoding # toJSONList :: [SystemTime] -> Value # toEncodingList :: [SystemTime] -> Encoding # omitField :: SystemTime -> Bool #
ToJSON UTCTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: UTCTime -> Value # toEncoding :: UTCTime -> Encoding # toJSONList :: [UTCTime] -> Value # toEncodingList :: [UTCTime] -> Encoding # omitField :: UTCTime -> Bool #
ToJSON CalendarDiffTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: CalendarDiffTime -> Value # toEncoding :: CalendarDiffTime -> Encoding # toJSONList :: [CalendarDiffTime] -> Value # toEncodingList :: [CalendarDiffTime] -> Encoding # omitField :: CalendarDiffTime -> Bool #
ToJSON LocalTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: LocalTime -> Value # toEncoding :: LocalTime -> Encoding # toJSONList :: [LocalTime] -> Value # toEncodingList :: [LocalTime] -> Encoding # omitField :: LocalTime -> Bool #
ToJSON TimeOfDay # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: TimeOfDay -> Value # toEncoding :: TimeOfDay -> Encoding # toJSONList :: [TimeOfDay] -> Value # toEncodingList :: [TimeOfDay] -> Encoding # omitField :: TimeOfDay -> Bool #
ToJSON ZonedTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: ZonedTime -> Value # toEncoding :: ZonedTime -> Encoding # toJSONList :: [ZonedTime] -> Value # toEncodingList :: [ZonedTime] -> Encoding # omitField :: ZonedTime -> Bool #
ToJSON UUID # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: UUID -> Value # toEncoding :: UUID -> Encoding # toJSONList :: [UUID] -> Value # toEncodingList :: [UUID] -> Encoding # omitField :: UUID -> Bool #
ToJSON Integer # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Integer -> Value # toEncoding :: Integer -> Encoding # toJSONList :: [Integer] -> Value # toEncodingList :: [Integer] -> Encoding # omitField :: Integer -> Bool #
ToJSON Natural # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Natural -> Value # toEncoding :: Natural -> Encoding # toJSONList :: [Natural] -> Value # toEncodingList :: [Natural] -> Encoding # omitField :: Natural -> Bool #
ToJSON () # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: () -> Value # toEncoding :: () -> Encoding # toJSONList :: [()] -> Value # toEncodingList :: [()] -> Encoding # omitField :: () -> Bool #
ToJSON Bool # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Bool -> Value # toEncoding :: Bool -> Encoding # toJSONList :: [Bool] -> Value # toEncodingList :: [Bool] -> Encoding # omitField :: Bool -> Bool #
ToJSON Char # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Char -> Value # toEncoding :: Char -> Encoding # toJSONList :: [Char] -> Value # toEncodingList :: [Char] -> Encoding # omitField :: Char -> Bool #
ToJSON Double # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Double -> Value # toEncoding :: Double -> Encoding # toJSONList :: [Double] -> Value # toEncodingList :: [Double] -> Encoding # omitField :: Double -> Bool #
ToJSON Float # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Float -> Value # toEncoding :: Float -> Encoding # toJSONList :: [Float] -> Value # toEncodingList :: [Float] -> Encoding # omitField :: Float -> Bool #
ToJSON Int # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Int -> Value # toEncoding :: Int -> Encoding # toJSONList :: [Int] -> Value # toEncodingList :: [Int] -> Encoding # omitField :: Int -> Bool #
ToJSON Word # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Word -> Value # toEncoding :: Word -> Encoding # toJSONList :: [Word] -> Value # toEncodingList :: [Word] -> Encoding # omitField :: Word -> Bool #
ToJSON v => ToJSON (KeyMap v) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: KeyMap v -> Value # toEncoding :: KeyMap v -> Encoding # toJSONList :: [KeyMap v] -> Value # toEncodingList :: [KeyMap v] -> Encoding # omitField :: KeyMap v -> Bool #
ToJSON a => ToJSON (First a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: First a -> Value # toEncoding :: First a -> Encoding # toJSONList :: [First a] -> Value # toEncodingList :: [First a] -> Encoding # omitField :: First a -> Bool #
ToJSON a => ToJSON (Last a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Last a -> Value # toEncoding :: Last a -> Encoding # toJSONList :: [Last a] -> Value # toEncodingList :: [Last a] -> Encoding # omitField :: Last a -> Bool #
ToJSON a => ToJSON (Max a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Max a -> Value # toEncoding :: Max a -> Encoding # toJSONList :: [Max a] -> Value # toEncodingList :: [Max a] -> Encoding # omitField :: Max a -> Bool #
ToJSON a => ToJSON (Min a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Min a -> Value # toEncoding :: Min a -> Encoding # toJSONList :: [Min a] -> Value # toEncodingList :: [Min a] -> Encoding # omitField :: Min a -> Bool #
ToJSON a => ToJSON (WrappedMonoid a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: WrappedMonoid a -> Value # toEncoding :: WrappedMonoid a -> Encoding # toJSONList :: [WrappedMonoid a] -> Value # toEncodingList :: [WrappedMonoid a] -> Encoding # omitField :: WrappedMonoid a -> Bool #
ToJSON a => ToJSON (IntMap a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: IntMap a -> Value # toEncoding :: IntMap a -> Encoding # toJSONList :: [IntMap a] -> Value # toEncodingList :: [IntMap a] -> Encoding # omitField :: IntMap a -> Bool #
ToJSON a => ToJSON (Seq a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Seq a -> Value # toEncoding :: Seq a -> Encoding # toJSONList :: [Seq a] -> Value # toEncodingList :: [Seq a] -> Encoding # omitField :: Seq a -> Bool #
ToJSON a => ToJSON (Set a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Set a -> Value # toEncoding :: Set a -> Encoding # toJSONList :: [Set a] -> Value # toEncodingList :: [Set a] -> Encoding # omitField :: Set a -> Bool #
ToJSON v => ToJSON (Tree v) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Tree v -> Value # toEncoding :: Tree v -> Encoding # toJSONList :: [Tree v] -> Value # toEncodingList :: [Tree v] -> Encoding # omitField :: Tree v -> Bool #
ToJSON1 f => ToJSON (Fix f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Fix f -> Value # toEncoding :: Fix f -> Encoding # toJSONList :: [Fix f] -> Value # toEncodingList :: [Fix f] -> Encoding # omitField :: Fix f -> Bool #
(ToJSON1 f, Functor f) => ToJSON (Mu f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Mu f -> Value # toEncoding :: Mu f -> Encoding # toJSONList :: [Mu f] -> Value # toEncodingList :: [Mu f] -> Encoding # omitField :: Mu f -> Bool #
(ToJSON1 f, Functor f) => ToJSON (Nu f) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Nu f -> Value # toEncoding :: Nu f -> Encoding # toJSONList :: [Nu f] -> Value # toEncodingList :: [Nu f] -> Encoding # omitField :: Nu f -> Bool #
ToJSON a => ToJSON (DNonEmpty a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DNonEmpty a -> Value # toEncoding :: DNonEmpty a -> Encoding # toJSONList :: [DNonEmpty a] -> Value # toEncodingList :: [DNonEmpty a] -> Encoding # omitField :: DNonEmpty a -> Bool #
ToJSON a => ToJSON (DList a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: DList a -> Value # toEncoding :: DList a -> Encoding # toJSONList :: [DList a] -> Value # toEncodingList :: [DList a] -> Encoding # omitField :: DList a -> Bool #
ToJSON a => ToJSON (NonEmpty a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: NonEmpty a -> Value # toEncoding :: NonEmpty a -> Encoding # toJSONList :: [NonEmpty a] -> Value # toEncodingList :: [NonEmpty a] -> Encoding # omitField :: NonEmpty a -> Bool #
ToJSON a => ToJSON (Identity a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Identity a -> Value # toEncoding :: Identity a -> Encoding # toJSONList :: [Identity a] -> Value # toEncodingList :: [Identity a] -> Encoding # omitField :: Identity a -> Bool #
ToJSON a => ToJSON (First a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: First a -> Value # toEncoding :: First a -> Encoding # toJSONList :: [First a] -> Value # toEncodingList :: [First a] -> Encoding # omitField :: First a -> Bool #
ToJSON a => ToJSON (Last a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Last a -> Value # toEncoding :: Last a -> Encoding # toJSONList :: [Last a] -> Value # toEncodingList :: [Last a] -> Encoding # omitField :: Last a -> Bool #
ToJSON a => ToJSON (Down a) # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Down a -> Value # toEncoding :: Down a -> Encoding # toJSONList :: [Down a] -> Value # toEncodingList :: [Down a] -> Encoding # omitField :: Down a -> Bool #
ToJSON a => ToJSON (Dual a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Dual a -> Value # toEncoding :: Dual a -> Encoding # toJSONList :: [Dual a] -> Value # toEncodingList :: [Dual a] -> Encoding # omitField :: Dual a -> Bool #
ToJSON a => ToJSON (Product a) # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Product a -> Value # toEncoding :: Product a -> Encoding # toJSONList :: [Product a] -> Value # toEncodingList :: [Product a] -> Encoding # omitField :: Product a -> Bool #
ToJSON a => ToJSON (Sum a) # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Sum a -> Value # toEncoding :: Sum a -> Encoding # toJSONList :: [Sum a] -> Value # toEncodingList :: [Sum a] -> Encoding # omitField :: Sum a -> Bool #
(Generic a, GToJSON' Value Zero (Rep a), GToJSON' Encoding Zero (Rep a)) => ToJSON (Generically a) # | Since: 2.1.0.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Generically a -> Value # toEncoding :: Generically a -> Encoding # toJSONList :: [Generically a] -> Value # toEncodingList :: [Generically a] -> Encoding # omitField :: Generically a -> Bool #
(ToJSON a, Integral a) => ToJSON (Ratio a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Ratio a -> Value # toEncoding :: Ratio a -> Encoding # toJSONList :: [Ratio a] -> Value # toEncodingList :: [Ratio a] -> Encoding # omitField :: Ratio a -> Bool #
ToJSON a => ToJSON (Array a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Array a -> Value # toEncoding :: Array a -> Encoding # toJSONList :: [Array a] -> Value # toEncodingList :: [Array a] -> Encoding # omitField :: Array a -> Bool #
(Prim a, ToJSON a) => ToJSON (PrimArray a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: PrimArray a -> Value # toEncoding :: PrimArray a -> Encoding # toJSONList :: [PrimArray a] -> Value # toEncodingList :: [PrimArray a] -> Encoding # omitField :: PrimArray a -> Bool #
ToJSON a => ToJSON (SmallArray a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: SmallArray a -> Value # toEncoding :: SmallArray a -> Encoding # toJSONList :: [SmallArray a] -> Value # toEncodingList :: [SmallArray a] -> Encoding # omitField :: SmallArray a -> Bool #
ToJSON a => ToJSON (Maybe a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Maybe a -> Value # toEncoding :: Maybe a -> Encoding # toJSONList :: [Maybe a] -> Value # toEncodingList :: [Maybe a] -> Encoding # omitField :: Maybe a -> Bool #
ToJSON a => ToJSON (HashSet a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: HashSet a -> Value # toEncoding :: HashSet a -> Encoding # toJSONList :: [HashSet a] -> Value # toEncodingList :: [HashSet a] -> Encoding # omitField :: HashSet a -> Bool #
ToJSON a => ToJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Vector a -> Value # toEncoding :: Vector a -> Encoding # toJSONList :: [Vector a] -> Value # toEncodingList :: [Vector a] -> Encoding # omitField :: Vector a -> Bool #
(Prim a, ToJSON a) => ToJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Vector a -> Value # toEncoding :: Vector a -> Encoding # toJSONList :: [Vector a] -> Value # toEncodingList :: [Vector a] -> Encoding # omitField :: Vector a -> Bool #
(Storable a, ToJSON a) => ToJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Vector a -> Value # toEncoding :: Vector a -> Encoding # toJSONList :: [Vector a] -> Value # toEncodingList :: [Vector a] -> Encoding # omitField :: Vector a -> Bool #
(Vector Vector a, ToJSON a) => ToJSON (Vector a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Vector a -> Value # toEncoding :: Vector a -> Encoding # toJSONList :: [Vector a] -> Value # toEncodingList :: [Vector a] -> Encoding # omitField :: Vector a -> Bool #
ToJSON a => ToJSON (Maybe a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Maybe a -> Value # toEncoding :: Maybe a -> Encoding # toJSONList :: [Maybe a] -> Value # toEncodingList :: [Maybe a] -> Encoding # omitField :: Maybe a -> Bool #
ToJSON a => ToJSON (Solo a) # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Solo a -> Value # toEncoding :: Solo a -> Encoding # toJSONList :: [Solo a] -> Value # toEncodingList :: [Solo a] -> Encoding # omitField :: Solo a -> Bool #
ToJSON a => ToJSON [a] # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: [a] -> Value # toEncoding :: [a] -> Encoding # toJSONList :: [[a]] -> Value # toEncodingList :: [[a]] -> Encoding # omitField :: [a] -> Bool #
HasResolution a => ToJSON (Fixed a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Fixed a -> Value # toEncoding :: Fixed a -> Encoding # toJSONList :: [Fixed a] -> Value # toEncodingList :: [Fixed a] -> Encoding # omitField :: Fixed a -> Bool #
(ToJSON v, ToJSONKey k) => ToJSON (Map k v) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Map k v -> Value # toEncoding :: Map k v -> Encoding # toJSONList :: [Map k v] -> Value # toEncodingList :: [Map k v] -> Encoding # omitField :: Map k v -> Bool #
(ToJSON a, ToJSON b) => ToJSON (Either a b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Either a b -> Value # toEncoding :: Either a b -> Encoding # toJSONList :: [Either a b] -> Value # toEncodingList :: [Either a b] -> Encoding # omitField :: Either a b -> Bool #
ToJSON (Proxy a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Proxy a -> Value # toEncoding :: Proxy a -> Encoding # toJSONList :: [Proxy a] -> Value # toEncodingList :: [Proxy a] -> Encoding # omitField :: Proxy a -> Bool #
(ToJSON a, ToJSON b) => ToJSON (Either a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Either a b -> Value # toEncoding :: Either a b -> Encoding # toJSONList :: [Either a b] -> Value # toEncodingList :: [Either a b] -> Encoding # omitField :: Either a b -> Bool #
(ToJSON a, ToJSON b) => ToJSON (These a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: These a b -> Value # toEncoding :: These a b -> Encoding # toJSONList :: [These a b] -> Value # toEncodingList :: [These a b] -> Encoding # omitField :: These a b -> Bool #
(ToJSON a, ToJSON b) => ToJSON (Pair a b) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Pair a b -> Value # toEncoding :: Pair a b -> Encoding # toJSONList :: [Pair a b] -> Value # toEncodingList :: [Pair a b] -> Encoding # omitField :: Pair a b -> Bool #
(ToJSON a, ToJSON b) => ToJSON (These a b) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: These a b -> Value # toEncoding :: These a b -> Encoding # toJSONList :: [These a b] -> Value # toEncodingList :: [These a b] -> Encoding # omitField :: These a b -> Bool #
(ToJSON v, ToJSONKey k) => ToJSON (HashMap k v) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: HashMap k v -> Value # toEncoding :: HashMap k v -> Encoding # toJSONList :: [HashMap k v] -> Value # toEncodingList :: [HashMap k v] -> Encoding # omitField :: HashMap k v -> Bool #
(ToJSON a, ToJSON b) => ToJSON (a, b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b) -> Value # toEncoding :: (a, b) -> Encoding # toJSONList :: [(a, b)] -> Value # toEncodingList :: [(a, b)] -> Encoding # omitField :: (a, b) -> Bool #
ToJSON a => ToJSON (Const a b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Const a b -> Value # toEncoding :: Const a b -> Encoding # toJSONList :: [Const a b] -> Value # toEncodingList :: [Const a b] -> Encoding # omitField :: Const a b -> Bool #
ToJSON b => ToJSON (Tagged a b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Tagged a b -> Value # toEncoding :: Tagged a b -> Encoding # toJSONList :: [Tagged a b] -> Value # toEncodingList :: [Tagged a b] -> Encoding # omitField :: Tagged a b -> Bool #
(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (These1 f g a) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: These1 f g a -> Value # toEncoding :: These1 f g a -> Encoding # toJSONList :: [These1 f g a] -> Value # toEncodingList :: [These1 f g a] -> Encoding # omitField :: These1 f g a -> Bool #
(ToJSON a, ToJSON b, ToJSON c) => ToJSON (a, b, c) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c) -> Value # toEncoding :: (a, b, c) -> Encoding # toJSONList :: [(a, b, c)] -> Value # toEncodingList :: [(a, b, c)] -> Encoding # omitField :: (a, b, c) -> Bool #
(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Product f g a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Product f g a -> Value # toEncoding :: Product f g a -> Encoding # toJSONList :: [Product f g a] -> Value # toEncodingList :: [Product f g a] -> Encoding # omitField :: Product f g a -> Bool #
(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Sum f g a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Sum f g a -> Value # toEncoding :: Sum f g a -> Encoding # toJSONList :: [Sum f g a] -> Value # toEncodingList :: [Sum f g a] -> Encoding # omitField :: Sum f g a -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d) => ToJSON (a, b, c, d) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d) -> Value # toEncoding :: (a, b, c, d) -> Encoding # toJSONList :: [(a, b, c, d)] -> Value # toEncodingList :: [(a, b, c, d)] -> Encoding # omitField :: (a, b, c, d) -> Bool #
(ToJSON1 f, ToJSON1 g, ToJSON a) => ToJSON (Compose f g a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: Compose f g a -> Value # toEncoding :: Compose f g a -> Encoding # toJSONList :: [Compose f g a] -> Value # toEncodingList :: [Compose f g a] -> Encoding # omitField :: Compose f g a -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e) => ToJSON (a, b, c, d, e) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e) -> Value # toEncoding :: (a, b, c, d, e) -> Encoding # toJSONList :: [(a, b, c, d, e)] -> Value # toEncodingList :: [(a, b, c, d, e)] -> Encoding # omitField :: (a, b, c, d, e) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f) => ToJSON (a, b, c, d, e, f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f) -> Value # toEncoding :: (a, b, c, d, e, f) -> Encoding # toJSONList :: [(a, b, c, d, e, f)] -> Value # toEncodingList :: [(a, b, c, d, e, f)] -> Encoding # omitField :: (a, b, c, d, e, f) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g) => ToJSON (a, b, c, d, e, f, g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g) -> Value # toEncoding :: (a, b, c, d, e, f, g) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g)] -> Encoding # omitField :: (a, b, c, d, e, f, g) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h) => ToJSON (a, b, c, d, e, f, g, h) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h) -> Value # toEncoding :: (a, b, c, d, e, f, g, h) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i) => ToJSON (a, b, c, d, e, f, g, h, i) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h, i) -> Value # toEncoding :: (a, b, c, d, e, f, g, h, i) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h, i)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h, i)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h, i) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j) => ToJSON (a, b, c, d, e, f, g, h, i, j) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h, i, j) -> Value # toEncoding :: (a, b, c, d, e, f, g, h, i, j) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h, i, j)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h, i, j)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h, i, j) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k) => ToJSON (a, b, c, d, e, f, g, h, i, j, k) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h, i, j, k) -> Value # toEncoding :: (a, b, c, d, e, f, g, h, i, j, k) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h, i, j, k) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Value # toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Value # toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Encoding # toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> Value # toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m)] -> Encoding # omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Bool #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n, ToJSON o) => ToJSON (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

toJSON :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Value #

toEncoding :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Encoding #

toJSONList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> Value #

toEncodingList :: [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)] -> Encoding #

omitField :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Bool #

class KeyValue e kv | kv -> e where #

A key-value pair for encoding a JSON object.

Methods

(.=) :: ToJSON v => Key -> v -> kv infixr 8 #

explicitToField :: (v -> e) -> Key -> v -> kv #

Since: 2.2.0.0

#### Instances

Instances details

KeyValue Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> Series # explicitToField :: (v -> Encoding) -> Key -> v -> Series #
value ~ Value => KeyValue Value (KeyMap value) # | Constructs a singleton `KeyMap`. For calling functions that demand an `Object` for constructing objects. To be used in conjunction with `mconcat`. Prefer to use `object` where possible.
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> KeyMap value # explicitToField :: (v -> Value) -> Key -> v -> KeyMap value #
(key ~ Key, value ~ Value) => KeyValue Value (key, value) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.=) :: ToJSON v => Key -> v -> (key, value) # explicitToField :: (v -> Value) -> Key -> v -> (key, value) #

class KeyValue e kv => KeyValueOmit e kv | kv -> e where #

An optional key-value pair for envoding to a JSON object

Since: 2.2.0.0

Methods

(.?=) :: ToJSON v => Key -> v -> kv infixr 8 #

explicitToFieldOmit :: (v -> Bool) -> (v -> e) -> Key -> v -> kv #

#### Instances

Instances details

KeyValueOmit Encoding Series # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> Series # explicitToFieldOmit :: (v -> Bool) -> (v -> Encoding) -> Key -> v -> Series #
value ~ Value => KeyValueOmit Value (KeyMap value) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods (.?=) :: ToJSON v => Key -> v -> KeyMap value # explicitToFieldOmit :: (v -> Bool) -> (v -> Value) -> Key -> v -> KeyMap value #

## Keys for maps

class ToJSONKey a where #

Typeclass for types that can be used as the key of a map-like container (like `Map` or `HashMap`). For example, since `Text` has a `ToJSONKey` instance and `Char` has a `ToJSON` instance, we can encode a value of type `Map` `Text` `Char`:

    >>> LBC8.putStrLn $ encode $ Map.fromList [("foo" :: Text, 'a')]
    {"foo":"a"}

Since `Int` also has a `ToJSONKey` instance, we can similarly write:

    >>> LBC8.putStrLn $ encode $ Map.fromList [(5 :: Int, 'a')]
    {"5":"a"}

JSON documents only accept strings as object keys. For any type from `base` that has a natural textual representation, it can be expected that its `ToJSONKey` instance will choose that representation.

For data types that lack a natural textual representation, an alternative is provided. The map-like container is represented as a JSON array instead of a JSON object. Each value in the array is an array with exactly two values. The first is the key and the second is the value.

For example, values of type '[Text]' cannot be encoded to a string, so a `Map` with keys of type '[Text]' is encoded as follows:

    >>> LBC8.putStrLn $ encode $ Map.fromList [(["foo","bar","baz" :: Text], 'a')]
    [[["foo","bar","baz"],"a"]]

The default implementation of `ToJSONKey` chooses this method of encoding a key, using the `ToJSON` instance of the type.

To use your own data type as the key in a map, all that is needed is to write a `ToJSONKey` (and possibly a `FromJSONKey`) instance for it. If the type cannot be trivially converted to and from `Text`, it is recommended that `ToJSONKeyValue` is used. Since the default implementations of the typeclass methods can build this from a `ToJSON` instance, there is nothing that needs to be written:

    data Foo = Foo { fooAge :: Int, fooName :: Text }
      deriving (Eq,Ord,Generic)
    instance ToJSON Foo
    instance ToJSONKey Foo

That's it. We can now write:

    >>> let m = Map.fromList [(Foo 4 "bar",'a'),(Foo 6 "arg",'b')]
    >>> LBC8.putStrLn $ encode m
    [[{"fooName":"bar","fooAge":4},"a"],[{"fooName":"arg","fooAge":6},"b"]]

The next case to consider is if we have a type that is a newtype wrapper around `Text`. The recommended approach is to use generalized newtype deriving:

    newtype RecordId = RecordId { getRecordId :: Text }
      deriving (Eq,Ord,ToJSONKey)

Then we may write:

    >>> LBC8.putStrLn $ encode $ Map.fromList [(RecordId "abc",'a')]
    {"abc":"a"}

Simple sum types are a final case worth considering. Suppose we have:

    data Color = Red | Green | Blue
      deriving (Show,Read,Eq,Ord)

It is possible to get the `ToJSONKey` instance for free as we did with `Foo`. However, in this case, we have a natural way to go to and from `Text` that does not require any escape sequences. So `ToJSONKeyText` can be used instead of `ToJSONKeyValue` to encode maps as objects instead of arrays of pairs. This instance may be implemented using generics as follows:

    instance ToJSONKey Color where
      toJSONKey = genericToJSONKey defaultJSONKeyOptions

### Low-level implementations

Expand

The `Show` instance can be used to help write `ToJSONKey`:

    instance ToJSONKey Color where
      toJSONKey = ToJSONKeyText f g
        where f = Text.pack . show
              g = text . Text.pack . show
              -- text function is from Data.Aeson.Encoding

The situation of needing to turning function `a -> Text` into a `ToJSONKeyFunction` is common enough that a special combinator is provided for it. The above instance can be rewritten as:

    instance ToJSONKey Color where
      toJSONKey = toJSONKeyText (Text.pack . show)

The performance of the above instance can be improved by not using `String` as an intermediate step when converting to `Text`. One option for improving performance would be to use template haskell machinery from the `text-show` package. However, even with the approach, the `Encoding` (a wrapper around a bytestring builder) is generated by encoding the `Text` to a `ByteString`, an intermediate step that could be avoided. The fastest possible implementation would be:

    -- Assuming that OverloadedStrings is enabled
    instance ToJSONKey Color where
      toJSONKey = ToJSONKeyText f g
        where f x = case x of {Red -> "Red";Green ->"Green";Blue -> "Blue"}
              g x = case x of {Red -> text "Red";Green -> text "Green";Blue -> text "Blue"}
              -- text function is from Data.Aeson.Encoding

This works because GHC can lift the encoded values out of the case statements, which means that they are only evaluated once. This approach should only be used when there is a serious need to maximize performance.

Minimal complete definition

Nothing

Methods

toJSONKey :: ToJSONKeyFunction a #

Strategy for rendering the key for a map-like container.

default toJSONKey :: ToJSON a => ToJSONKeyFunction a #

toJSONKeyList :: ToJSONKeyFunction [a] #

This is similar in spirit to the `showsList` method of `Show`. It makes it possible to give `String` keys special treatment without using `OverlappingInstances`. End users should always be able to use the default implementation of this method.

default toJSONKeyList :: ToJSON a => ToJSONKeyFunction [a] #

#### Instances

Instances details

ToJSONKey Key # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Key # toJSONKeyList :: ToJSONKeyFunction [Key] #
ToJSONKey Void # | Since: 2.1.2.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Void # toJSONKeyList :: ToJSONKeyFunction [Void] #
ToJSONKey Version # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Version # toJSONKeyList :: ToJSONKeyFunction [Version] #
ToJSONKey Int16 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Int16 # toJSONKeyList :: ToJSONKeyFunction [Int16] #
ToJSONKey Int32 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Int32 # toJSONKeyList :: ToJSONKeyFunction [Int32] #
ToJSONKey Int64 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Int64 # toJSONKeyList :: ToJSONKeyFunction [Int64] #
ToJSONKey Int8 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Int8 # toJSONKeyList :: ToJSONKeyFunction [Int8] #
ToJSONKey Word16 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Word16 # toJSONKeyList :: ToJSONKeyFunction [Word16] #
ToJSONKey Word32 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Word32 # toJSONKeyList :: ToJSONKeyFunction [Word32] #
ToJSONKey Word64 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Word64 # toJSONKeyList :: ToJSONKeyFunction [Word64] #
ToJSONKey Word8 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Word8 # toJSONKeyList :: ToJSONKeyFunction [Word8] #
ToJSONKey URI # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction URI # toJSONKeyList :: ToJSONKeyFunction [URI] #
ToJSONKey Scientific # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Scientific # toJSONKeyList :: ToJSONKeyFunction [Scientific] #
ToJSONKey Text # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Text # toJSONKeyList :: ToJSONKeyFunction [Text] #
ToJSONKey Text # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Text # toJSONKeyList :: ToJSONKeyFunction [Text] #
ToJSONKey ShortText # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction ShortText # toJSONKeyList :: ToJSONKeyFunction [ShortText] #
ToJSONKey Day # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Day # toJSONKeyList :: ToJSONKeyFunction [Day] #
ToJSONKey Month # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Month # toJSONKeyList :: ToJSONKeyFunction [Month] #
ToJSONKey Quarter # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Quarter # toJSONKeyList :: ToJSONKeyFunction [Quarter] #
ToJSONKey QuarterOfYear # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction QuarterOfYear # toJSONKeyList :: ToJSONKeyFunction [QuarterOfYear] #
ToJSONKey DayOfWeek # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction DayOfWeek # toJSONKeyList :: ToJSONKeyFunction [DayOfWeek] #
ToJSONKey UTCTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction UTCTime # toJSONKeyList :: ToJSONKeyFunction [UTCTime] #
ToJSONKey LocalTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction LocalTime # toJSONKeyList :: ToJSONKeyFunction [LocalTime] #
ToJSONKey TimeOfDay # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction TimeOfDay # toJSONKeyList :: ToJSONKeyFunction [TimeOfDay] #
ToJSONKey ZonedTime # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction ZonedTime # toJSONKeyList :: ToJSONKeyFunction [ZonedTime] #
ToJSONKey UUID # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction UUID # toJSONKeyList :: ToJSONKeyFunction [UUID] #
ToJSONKey Integer # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Integer # toJSONKeyList :: ToJSONKeyFunction [Integer] #
ToJSONKey Natural # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Natural # toJSONKeyList :: ToJSONKeyFunction [Natural] #
ToJSONKey Bool # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Bool # toJSONKeyList :: ToJSONKeyFunction [Bool] #
ToJSONKey Char # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Char # toJSONKeyList :: ToJSONKeyFunction [Char] #
ToJSONKey Double # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Double # toJSONKeyList :: ToJSONKeyFunction [Double] #
ToJSONKey Float # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Float # toJSONKeyList :: ToJSONKeyFunction [Float] #
ToJSONKey Int # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Int # toJSONKeyList :: ToJSONKeyFunction [Int] #
ToJSONKey Word # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction Word # toJSONKeyList :: ToJSONKeyFunction [Word] #
ToJSONKey a => ToJSONKey (Identity a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (Identity a) # toJSONKeyList :: ToJSONKeyFunction [Identity a] #
ToJSONKey a => ToJSONKey (Solo a) # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (Solo a) # toJSONKeyList :: ToJSONKeyFunction [Solo a] #
(ToJSONKey a, ToJSON a) => ToJSONKey [a] # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction [a] # toJSONKeyList :: ToJSONKeyFunction [[a]] #
HasResolution a => ToJSONKey (Fixed a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (Fixed a) # toJSONKeyList :: ToJSONKeyFunction [Fixed a] #
(ToJSON a, ToJSON b) => ToJSONKey (a, b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (a, b) # toJSONKeyList :: ToJSONKeyFunction [(a, b)] #
(ToJSON a, ToJSONKey a) => ToJSONKey (Const a b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (Const a b) # toJSONKeyList :: ToJSONKeyFunction [Const a b] #
ToJSONKey b => ToJSONKey (Tagged a b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (Tagged a b) # toJSONKeyList :: ToJSONKeyFunction [Tagged a b] #
(ToJSON a, ToJSON b, ToJSON c) => ToJSONKey (a, b, c) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (a, b, c) # toJSONKeyList :: ToJSONKeyFunction [(a, b, c)] #
(ToJSON a, ToJSON b, ToJSON c, ToJSON d) => ToJSONKey (a, b, c, d) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods toJSONKey :: ToJSONKeyFunction (a, b, c, d) # toJSONKeyList :: ToJSONKeyFunction [(a, b, c, d)] #

data ToJSONKeyFunction a #

Constructors

ToJSONKeyText !(a -> Key) !(a -> Encoding' Key) | key is encoded to string, produces object
ToJSONKeyValue !(a -> Value) !(a -> Encoding) | key is encoded to value, produces array

#### Instances

Instances details

Contravariant ToJSONKeyFunction # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods contramap :: (a' -> a) -> ToJSONKeyFunction a -> ToJSONKeyFunction a' # (>$) :: b -> ToJSONKeyFunction b -> ToJSONKeyFunction a #

toJSONKeyText :: (a -> Text) -> ToJSONKeyFunction a #

Helper for creating textual keys.

    instance ToJSONKey MyKey where
        toJSONKey = toJSONKeyText myKeyToText
          where
            myKeyToText = Text.pack . show -- or showt from text-show

toJSONKeyKey :: (a -> Key) -> ToJSONKeyFunction a #

Since: 2.0.0.0

contramapToJSONKeyFunction :: (b -> a) -> ToJSONKeyFunction a -> ToJSONKeyFunction b #

Contravariant map, as `ToJSONKeyFunction` is a contravariant functor.

class FromJSONKey a where #

Read the docs for `ToJSONKey` first. This class is a conversion in the opposite direction. If you have a newtype wrapper around `Text`, the recommended way to define instances is with generalized newtype deriving:

    newtype SomeId = SomeId { getSomeId :: Text }
      deriving (Eq,Ord,Hashable,FromJSONKey)

If you have a sum of nullary constructors, you may use the generic implementation:

    data Color = Red | Green | Blue
      deriving Generic

    instance FromJSONKey Color where
      fromJSONKey = genericFromJSONKey defaultJSONKeyOptions

Minimal complete definition

Nothing

Methods

fromJSONKey :: FromJSONKeyFunction a #

Strategy for parsing the key of a map-like container.

default fromJSONKey :: FromJSON a => FromJSONKeyFunction a #

fromJSONKeyList :: FromJSONKeyFunction [a] #

This is similar in spirit to the `readList` method of `Read`. It makes it possible to give `String` keys special treatment without using `OverlappingInstances`. End users should always be able to use the default implementation of this method.

default fromJSONKeyList :: FromJSON a => FromJSONKeyFunction [a] #

#### Instances

Instances details

FromJSONKey Key # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Key # fromJSONKeyList :: FromJSONKeyFunction [Key] #
FromJSONKey Void # | Since: 2.1.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Void # fromJSONKeyList :: FromJSONKeyFunction [Void] #
FromJSONKey Version # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Version # fromJSONKeyList :: FromJSONKeyFunction [Version] #
FromJSONKey Int16 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Int16 # fromJSONKeyList :: FromJSONKeyFunction [Int16] #
FromJSONKey Int32 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Int32 # fromJSONKeyList :: FromJSONKeyFunction [Int32] #
FromJSONKey Int64 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Int64 # fromJSONKeyList :: FromJSONKeyFunction [Int64] #
FromJSONKey Int8 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Int8 # fromJSONKeyList :: FromJSONKeyFunction [Int8] #
FromJSONKey Word16 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Word16 # fromJSONKeyList :: FromJSONKeyFunction [Word16] #
FromJSONKey Word32 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Word32 # fromJSONKeyList :: FromJSONKeyFunction [Word32] #
FromJSONKey Word64 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Word64 # fromJSONKeyList :: FromJSONKeyFunction [Word64] #
FromJSONKey Word8 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Word8 # fromJSONKeyList :: FromJSONKeyFunction [Word8] #
FromJSONKey URI # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction URI # fromJSONKeyList :: FromJSONKeyFunction [URI] #
FromJSONKey Text # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Text # fromJSONKeyList :: FromJSONKeyFunction [Text] #
FromJSONKey Text # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Text # fromJSONKeyList :: FromJSONKeyFunction [Text] #
FromJSONKey ShortText # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction ShortText # fromJSONKeyList :: FromJSONKeyFunction [ShortText] #
FromJSONKey Day # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Day # fromJSONKeyList :: FromJSONKeyFunction [Day] #
FromJSONKey Month # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Month # fromJSONKeyList :: FromJSONKeyFunction [Month] #
FromJSONKey Quarter # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Quarter # fromJSONKeyList :: FromJSONKeyFunction [Quarter] #
FromJSONKey QuarterOfYear # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction QuarterOfYear # fromJSONKeyList :: FromJSONKeyFunction [QuarterOfYear] #
FromJSONKey DayOfWeek # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction DayOfWeek # fromJSONKeyList :: FromJSONKeyFunction [DayOfWeek] #
FromJSONKey UTCTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction UTCTime # fromJSONKeyList :: FromJSONKeyFunction [UTCTime] #
FromJSONKey LocalTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction LocalTime # fromJSONKeyList :: FromJSONKeyFunction [LocalTime] #
FromJSONKey TimeOfDay # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction TimeOfDay # fromJSONKeyList :: FromJSONKeyFunction [TimeOfDay] #
FromJSONKey ZonedTime # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction ZonedTime # fromJSONKeyList :: FromJSONKeyFunction [ZonedTime] #
FromJSONKey UUID # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction UUID # fromJSONKeyList :: FromJSONKeyFunction [UUID] #
FromJSONKey Integer # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Integer # fromJSONKeyList :: FromJSONKeyFunction [Integer] #
FromJSONKey Natural # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Natural # fromJSONKeyList :: FromJSONKeyFunction [Natural] #
FromJSONKey Bool # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Bool # fromJSONKeyList :: FromJSONKeyFunction [Bool] #
FromJSONKey Char # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Char # fromJSONKeyList :: FromJSONKeyFunction [Char] #
FromJSONKey Double # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Double # fromJSONKeyList :: FromJSONKeyFunction [Double] #
FromJSONKey Float # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Float # fromJSONKeyList :: FromJSONKeyFunction [Float] #
FromJSONKey Int # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Int # fromJSONKeyList :: FromJSONKeyFunction [Int] #
FromJSONKey Word # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction Word # fromJSONKeyList :: FromJSONKeyFunction [Word] #
FromJSONKey a => FromJSONKey (Identity a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (Identity a) # fromJSONKeyList :: FromJSONKeyFunction [Identity a] #
FromJSONKey a => FromJSONKey (Solo a) # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (Solo a) # fromJSONKeyList :: FromJSONKeyFunction [Solo a] #
(FromJSONKey a, FromJSON a) => FromJSONKey [a] # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction [a] # fromJSONKeyList :: FromJSONKeyFunction [[a]] #
(FromJSON a, FromJSON b) => FromJSONKey (a, b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (a, b) # fromJSONKeyList :: FromJSONKeyFunction [(a, b)] #
(FromJSON a, FromJSONKey a) => FromJSONKey (Const a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (Const a b) # fromJSONKeyList :: FromJSONKeyFunction [Const a b] #
FromJSONKey b => FromJSONKey (Tagged a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (Tagged a b) # fromJSONKeyList :: FromJSONKeyFunction [Tagged a b] #
(FromJSON a, FromJSON b, FromJSON c) => FromJSONKey (a, b, c) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (a, b, c) # fromJSONKeyList :: FromJSONKeyFunction [(a, b, c)] #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d) => FromJSONKey (a, b, c, d) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods fromJSONKey :: FromJSONKeyFunction (a, b, c, d) # fromJSONKeyList :: FromJSONKeyFunction [(a, b, c, d)] #

data FromJSONKeyFunction a where #

This type is related to `ToJSONKeyFunction`. If `FromJSONKeyValue` is used in the `FromJSONKey` instance, then `ToJSONKeyValue` should be used in the `ToJSONKey` instance. The other three data constructors for this type all correspond to `ToJSONKeyText`. Strictly speaking, `FromJSONKeyTextParser` is more powerful than `FromJSONKeyText`, which is in turn more powerful than `FromJSONKeyCoerce`. For performance reasons, these exist as three options instead of one.

Constructors

FromJSONKeyCoerce |

Fields

- :: forall a. Coercible Text a
- => FromJSONKeyFunction a

  uses `coerce`, we expect that `Hashable` and `Ord` instance are compatible.

FromJSONKeyText |

Fields

- :: forall a. !(Text -> a)
- -> FromJSONKeyFunction a

  conversion from `Text` that always succeeds

FromJSONKeyTextParser |

Fields

- :: forall a. !(Text -> Parser a)
- -> FromJSONKeyFunction a

  conversion from `Text` that may fail

FromJSONKeyValue |

Fields

- :: forall a. !(Value -> Parser a)
- -> FromJSONKeyFunction a

  conversion for non-textual keys

#### Instances

Instances details

Functor FromJSONKeyFunction # | Only law abiding up to interpretation
Instance details Defined in Data.Aeson.Types.FromJSON Methods fmap :: (a -> b) -> FromJSONKeyFunction a -> FromJSONKeyFunction b # (<$) :: a -> FromJSONKeyFunction b -> FromJSONKeyFunction a #

fromJSONKeyCoerce :: Coercible Text a => FromJSONKeyFunction a #

Construct `FromJSONKeyFunction` for types coercible from `Text`. This conversion is still unsafe, as `Hashable` and `Eq` instances of `a` should be compatible with `Text` i.e. hash values should be equal for wrapped values as well. This property will always be maintained if the `Hashable` and `Eq` instances are derived with generalized newtype deriving. compatible with `Text` i.e. hash values be equal for wrapped values as well.

On pre GHC 7.8 this is unconstrained function.

coerceFromJSONKeyFunction :: Coercible a b => FromJSONKeyFunction a -> FromJSONKeyFunction b #

Semantically the same as `coerceFromJSONKeyFunction = fmap coerce = coerce`.

See note on `fromJSONKeyCoerce`.

mapFromJSONKeyFunction :: (a -> b) -> FromJSONKeyFunction a -> FromJSONKeyFunction b #

Same as `fmap`. Provided for the consistency with `ToJSONKeyFunction`.

### Generic keys

class GetConName f => GToJSONKey (f :: k -> Type) #

#### Instances

Instances details

GetConName f => GToJSONKey (f :: k -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON

genericToJSONKey :: (Generic a, GToJSONKey (Rep a)) => JSONKeyOptions -> ToJSONKeyFunction a #

class (ConstructorNames f, SumFromString f) => GFromJSONKey (f :: Type -> Type) #

#### Instances

Instances details

(ConstructorNames f, SumFromString f) => GFromJSONKey f # |
Instance details Defined in Data.Aeson.Types.FromJSON

genericFromJSONKey :: (Generic a, GFromJSONKey (Rep a)) => JSONKeyOptions -> FromJSONKeyFunction a #

`fromJSONKey` for `Generic` types. These types must be sums of nullary constructors, whose names will be used as keys for JSON objects.

See also `genericToJSONKey`.

### Example

Expand

    data Color = Red | Green | Blue
      deriving Generic

    instance FromJSONKey Color where
      fromJSONKey = genericFromJSONKey defaultJSONKeyOptions

## Liftings to unary and binary type constructors

class FromJSON1 (f :: Type -> Type) where #

Lifting of the `FromJSON` class to unary type constructors.

Instead of manually writing your `FromJSON1` instance, there are two options to do it automatically:

- Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
- The compiler can provide a default generic implementation for `liftParseJSON`.

To use the second, simply add a `deriving `Generic1`` clause to your datatype and declare a `FromJSON1` instance for your datatype without giving a definition for `liftParseJSON`.

For example:

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics

    data Pair a b = Pair { pairFst :: a, pairSnd :: b } deriving Generic1

    instance FromJSON a => FromJSON1 (Pair a)

or

    deriving via Generically1 (Pair a) instance FromJSON1 (Pair a)

If the default implementation doesn't give exactly the results you want, you can customize the generic decoding with only a tiny amount of effort, using `genericLiftParseJSON` with your preferred `Options`:

    customOptions = defaultOptions
                    { fieldLabelModifier = map toUpper
                    }

    instance FromJSON a => FromJSON1 (Pair a) where
        liftParseJSON = genericLiftParseJSON customOptions

Minimal complete definition

Nothing

Methods

liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) #

default liftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) #

liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a] #

liftOmittedField :: Maybe a -> Maybe (f a) #

#### Instances

Instances details

FromJSON1 KeyMap # | Since: 2.0.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (KeyMap a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [KeyMap a] # liftOmittedField :: Maybe a -> Maybe (KeyMap a) #
FromJSON1 First # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (First a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [First a] # liftOmittedField :: Maybe a -> Maybe (First a) #
FromJSON1 Last # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Last a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Last a] # liftOmittedField :: Maybe a -> Maybe (Last a) #
FromJSON1 Max # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Max a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Max a] # liftOmittedField :: Maybe a -> Maybe (Max a) #
FromJSON1 Min # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Min a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Min a] # liftOmittedField :: Maybe a -> Maybe (Min a) #
FromJSON1 WrappedMonoid # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (WrappedMonoid a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [WrappedMonoid a] # liftOmittedField :: Maybe a -> Maybe (WrappedMonoid a) #
FromJSON1 IntMap # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (IntMap a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [IntMap a] # liftOmittedField :: Maybe a -> Maybe (IntMap a) #
FromJSON1 Seq # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Seq a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Seq a] # liftOmittedField :: Maybe a -> Maybe (Seq a) #
FromJSON1 Tree # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Tree a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Tree a] # liftOmittedField :: Maybe a -> Maybe (Tree a) #
FromJSON1 DNonEmpty # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (DNonEmpty a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [DNonEmpty a] # liftOmittedField :: Maybe a -> Maybe (DNonEmpty a) #
FromJSON1 DList # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (DList a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [DList a] # liftOmittedField :: Maybe a -> Maybe (DList a) #
FromJSON1 NonEmpty # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (NonEmpty a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [NonEmpty a] # liftOmittedField :: Maybe a -> Maybe (NonEmpty a) #
FromJSON1 Identity # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Identity a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Identity a] # liftOmittedField :: Maybe a -> Maybe (Identity a) #
FromJSON1 First # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (First a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [First a] # liftOmittedField :: Maybe a -> Maybe (First a) #
FromJSON1 Last # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Last a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Last a] # liftOmittedField :: Maybe a -> Maybe (Last a) #
FromJSON1 Down # | Since: 2.2.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Down a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Down a] # liftOmittedField :: Maybe a -> Maybe (Down a) #
FromJSON1 Dual # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Dual a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Dual a] # liftOmittedField :: Maybe a -> Maybe (Dual a) #
FromJSON1 Product # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Product a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Product a] # liftOmittedField :: Maybe a -> Maybe (Product a) #
FromJSON1 Sum # | Since: 2.2.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Sum a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Sum a] # liftOmittedField :: Maybe a -> Maybe (Sum a) #
FromJSON1 Maybe # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Maybe a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Maybe a] # liftOmittedField :: Maybe a -> Maybe (Maybe a) #
FromJSON1 Vector # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Vector a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Vector a] # liftOmittedField :: Maybe a -> Maybe (Vector a) #
FromJSON1 Maybe # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Maybe a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Maybe a] # liftOmittedField :: Maybe a -> Maybe (Maybe a) #
FromJSON1 Solo # | Since: 2.0.2.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Solo a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Solo a] # liftOmittedField :: Maybe a -> Maybe (Solo a) #
FromJSON1 [] # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [a] # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [[a]] # liftOmittedField :: Maybe a -> Maybe [a] #
(FromJSONKey k, Ord k) => FromJSON1 (Map k) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Map k a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Map k a] # liftOmittedField :: Maybe a -> Maybe (Map k a) #
FromJSON a => FromJSON1 (Either a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (Either a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [Either a a0] # liftOmittedField :: Maybe a0 -> Maybe (Either a a0) #
FromJSON1 (Proxy :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Proxy a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Proxy a] # liftOmittedField :: Maybe a -> Maybe (Proxy a) #
FromJSON a => FromJSON1 (Either a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (Either a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [Either a a0] # liftOmittedField :: Maybe a0 -> Maybe (Either a a0) #
FromJSON a => FromJSON1 (These a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (These a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [These a a0] # liftOmittedField :: Maybe a0 -> Maybe (These a a0) #
FromJSON a => FromJSON1 (Pair a) # | Since: 1.5.3.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (Pair a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [Pair a a0] # liftOmittedField :: Maybe a0 -> Maybe (Pair a a0) #
FromJSON a => FromJSON1 (These a) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (These a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [These a a0] # liftOmittedField :: Maybe a0 -> Maybe (These a a0) #
(FromJSONKey k, Eq k, Hashable k) => FromJSON1 (HashMap k) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (HashMap k a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [HashMap k a] # liftOmittedField :: Maybe a -> Maybe (HashMap k a) #
FromJSON a => FromJSON1 ((,) a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, a0) #
FromJSON a => FromJSON1 (Const a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (Const a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [Const a a0] # liftOmittedField :: Maybe a0 -> Maybe (Const a a0) #
(Generic1 f, GFromJSON One (Rep1 f)) => FromJSON1 (Generically1 f) # | Since: 2.1.0.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Generically1 f a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Generically1 f a] # liftOmittedField :: Maybe a -> Maybe (Generically1 f a) #
FromJSON1 (Tagged a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (Tagged a a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [Tagged a a0] # liftOmittedField :: Maybe a0 -> Maybe (Tagged a a0) #
(FromJSON1 f, FromJSON1 g) => FromJSON1 (These1 f g) # | Since: 1.5.1.0
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (These1 f g a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [These1 f g a] # liftOmittedField :: Maybe a -> Maybe (These1 f g a) #
(FromJSON a, FromJSON b) => FromJSON1 ((,,) a b) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, a0) #
(FromJSON1 f, FromJSON1 g) => FromJSON1 (Product f g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Product f g a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Product f g a] # liftOmittedField :: Maybe a -> Maybe (Product f g a) #
(FromJSON1 f, FromJSON1 g) => FromJSON1 (Sum f g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Sum f g a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Sum f g a] # liftOmittedField :: Maybe a -> Maybe (Sum f g a) #
(FromJSON a, FromJSON b, FromJSON c) => FromJSON1 ((,,,) a b c) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, a0) #
(FromJSON1 f, FromJSON1 g) => FromJSON1 (Compose f g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (Compose f g a) # liftParseJSONList :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [Compose f g a] # liftOmittedField :: Maybe a -> Maybe (Compose f g a) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d) => FromJSON1 ((,,,,) a b c d) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e) => FromJSON1 ((,,,,,) a b c d e) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f) => FromJSON1 ((,,,,,,) a b c d e f) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g) => FromJSON1 ((,,,,,,,) a b c d e f g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h) => FromJSON1 ((,,,,,,,,) a b c d e f g h) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i) => FromJSON1 ((,,,,,,,,,) a b c d e f g h i) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, a0) # liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, a0)] # liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, a0) #
(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j) => FromJSON1 ((,,,,,,,,,,) a b c d e f g h i j) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, a0)] #

liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, j, a0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k) => FromJSON1 ((,,,,,,,,,,,) a b c d e f g h i j k) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, a0)] #

liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, a0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l) => FromJSON1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, a0)] #

liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, l, a0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m) => FromJSON1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0)] #

liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m, FromJSON n) => FromJSON1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) #

liftParseJSONList :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0)] #

liftOmittedField :: Maybe a0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) #

parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a) #

Lift the standard `parseJSON` function through the type constructor.

omittedField1 :: (FromJSON1 f, FromJSON a) => Maybe (f a) #

Since: 2.2.0.0

class FromJSON2 (f :: Type -> Type -> Type) where #

Lifting of the `FromJSON` class to binary type constructors.

Instead of manually writing your `FromJSON2` instance, Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time.

Minimal complete definition

liftParseJSON2

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (f a b) #

#### Instances

Instances details

FromJSON2 Either # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Either a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Either a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (Either a b) #

FromJSON2 Either # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Either a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Either a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (Either a b) #

FromJSON2 These # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (These a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [These a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (These a b) #

FromJSON2 Pair # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Pair a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Pair a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (Pair a b) #

FromJSON2 These # | Since: 1.5.1.0

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (These a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [These a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (These a b) #

FromJSON2 (,) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (a, b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [(a, b)] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (a, b) #

FromJSON2 (Const :: Type -> Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Const a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Const a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (Const a b) #

FromJSON2 (Tagged :: Type -> Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (Tagged a b) #

liftParseJSONList2 :: Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [Tagged a b] #

liftOmittedField2 :: Maybe a -> Maybe b -> Maybe (Tagged a b) #

FromJSON a => FromJSON2 ((,,) a) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (a, a0, b) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [(a, a0, b)] #

liftOmittedField2 :: Maybe a0 -> Maybe b -> Maybe (a, a0, b) #

(FromJSON a, FromJSON b) => FromJSON2 ((,,,) a b) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c) => FromJSON2 ((,,,,) a b c) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d) => FromJSON2 ((,,,,,) a b c d) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e) => FromJSON2 ((,,,,,,) a b c d e) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f) => FromJSON2 ((,,,,,,,) a b c d e f) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g) => FromJSON2 ((,,,,,,,,) a b c d e f g) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h) => FromJSON2 ((,,,,,,,,,) a b c d e f g h) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i) => FromJSON2 ((,,,,,,,,,,) a b c d e f g h i) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, i, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j) => FromJSON2 ((,,,,,,,,,,,) a b c d e f g h i j) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, i, j, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k) => FromJSON2 ((,,,,,,,,,,,,) a b c d e f g h i j k) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l) => FromJSON2 ((,,,,,,,,,,,,,) a b c d e f g h i j k l) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, l, a0, b0) #

(FromJSON a, FromJSON b, FromJSON c, FromJSON d, FromJSON e, FromJSON f, FromJSON g, FromJSON h, FromJSON i, FromJSON j, FromJSON k, FromJSON l, FromJSON m) => FromJSON2 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m) # |

Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser (a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0) #

liftParseJSONList2 :: Maybe a0 -> (Value -> Parser a0) -> (Value -> Parser [a0]) -> Maybe b0 -> (Value -> Parser b0) -> (Value -> Parser [b0]) -> Value -> Parser [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0)] #

liftOmittedField2 :: Maybe a0 -> Maybe b0 -> Maybe (a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0) #

parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b) #

Lift the standard `parseJSON` function through the type constructor.

omittedField2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Maybe (f a b) #

Since: 2.2.0.0

class ToJSON1 (f :: Type -> Type) where #

Lifting of the `ToJSON` class to unary type constructors.

Instead of manually writing your `ToJSON1` instance, there are two options to do it automatically:

- Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time. The generated instance is optimized for your type so it will probably be more efficient than the following option.
- The compiler can provide a default generic implementation for `toJSON1`.

To use the second, simply add a `deriving `Generic1`` clause to your datatype and declare a `ToJSON1` instance for your datatype without giving definitions for `liftToJSON` or `liftToEncoding`.

For example:

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics

    data Pair a b = Pair { pairFst :: a, pairSnd :: b } deriving Generic1

    instance ToJSON a => ToJSON1 (Pair a)

If the default implementation doesn't give exactly the results you want, you can customize the generic encoding with only a tiny amount of effort, using `genericLiftToJSON` and `genericLiftToEncoding` with your preferred `Options`:

    customOptions = defaultOptions
                    { fieldLabelModifier = map toUpper
                    }

    instance ToJSON a => ToJSON1 (Pair a) where
        liftToJSON     = genericLiftToJSON customOptions
        liftToEncoding = genericLiftToEncoding customOptions

See also `ToJSON`.

Minimal complete definition

Nothing

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value #

default liftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [f a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding #

default liftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding #

liftOmitField :: (a -> Bool) -> f a -> Bool #

Since: 2.2.0.0

#### Instances

Instances details

ToJSON1 KeyMap # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> KeyMap a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [KeyMap a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> KeyMap a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [KeyMap a] -> Encoding #

liftOmitField :: (a -> Bool) -> KeyMap a -> Bool #

ToJSON1 First # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> First a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [First a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> First a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [First a] -> Encoding #

liftOmitField :: (a -> Bool) -> First a -> Bool #

ToJSON1 Last # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Last a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Last a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Last a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Last a] -> Encoding #

liftOmitField :: (a -> Bool) -> Last a -> Bool #

ToJSON1 Max # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Max a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Max a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Max a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Max a] -> Encoding #

liftOmitField :: (a -> Bool) -> Max a -> Bool #

ToJSON1 Min # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Min a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Min a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Min a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Min a] -> Encoding #

liftOmitField :: (a -> Bool) -> Min a -> Bool #

ToJSON1 WrappedMonoid # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> WrappedMonoid a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [WrappedMonoid a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> WrappedMonoid a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [WrappedMonoid a] -> Encoding #

liftOmitField :: (a -> Bool) -> WrappedMonoid a -> Bool #

ToJSON1 IntMap # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> IntMap a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [IntMap a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> IntMap a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [IntMap a] -> Encoding #

liftOmitField :: (a -> Bool) -> IntMap a -> Bool #

ToJSON1 Seq # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Seq a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Seq a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Seq a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Seq a] -> Encoding #

liftOmitField :: (a -> Bool) -> Seq a -> Bool #

ToJSON1 Set # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Set a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Set a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Set a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Set a] -> Encoding #

liftOmitField :: (a -> Bool) -> Set a -> Bool #

ToJSON1 Tree # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Tree a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Tree a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Tree a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Tree a] -> Encoding #

liftOmitField :: (a -> Bool) -> Tree a -> Bool #

ToJSON1 DNonEmpty # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> DNonEmpty a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [DNonEmpty a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> DNonEmpty a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [DNonEmpty a] -> Encoding #

liftOmitField :: (a -> Bool) -> DNonEmpty a -> Bool #

ToJSON1 DList # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> DList a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [DList a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> DList a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [DList a] -> Encoding #

liftOmitField :: (a -> Bool) -> DList a -> Bool #

ToJSON1 NonEmpty # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> NonEmpty a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [NonEmpty a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> NonEmpty a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [NonEmpty a] -> Encoding #

liftOmitField :: (a -> Bool) -> NonEmpty a -> Bool #

ToJSON1 Identity # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Identity a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Identity a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Identity a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Identity a] -> Encoding #

liftOmitField :: (a -> Bool) -> Identity a -> Bool #

ToJSON1 First # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> First a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [First a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> First a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [First a] -> Encoding #

liftOmitField :: (a -> Bool) -> First a -> Bool #

ToJSON1 Last # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Last a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Last a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Last a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Last a] -> Encoding #

liftOmitField :: (a -> Bool) -> Last a -> Bool #

ToJSON1 Down # | Since: 2.2.0.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Down a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Down a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Down a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Down a] -> Encoding #

liftOmitField :: (a -> Bool) -> Down a -> Bool #

ToJSON1 Dual # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Dual a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Dual a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Dual a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Dual a] -> Encoding #

liftOmitField :: (a -> Bool) -> Dual a -> Bool #

ToJSON1 Product # | Since: 2.2.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Product a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Product a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Product a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Product a] -> Encoding #

liftOmitField :: (a -> Bool) -> Product a -> Bool #

ToJSON1 Sum # | Since: 2.2.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Sum a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Sum a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Sum a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Sum a] -> Encoding #

liftOmitField :: (a -> Bool) -> Sum a -> Bool #

ToJSON1 Maybe # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Maybe a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding #

liftOmitField :: (a -> Bool) -> Maybe a -> Bool #

ToJSON1 HashSet # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> HashSet a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [HashSet a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> HashSet a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [HashSet a] -> Encoding #

liftOmitField :: (a -> Bool) -> HashSet a -> Bool #

ToJSON1 Vector # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Vector a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Vector a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Vector a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Vector a] -> Encoding #

liftOmitField :: (a -> Bool) -> Vector a -> Bool #

ToJSON1 Maybe # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Maybe a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Maybe a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Maybe a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Maybe a] -> Encoding #

liftOmitField :: (a -> Bool) -> Maybe a -> Bool #

ToJSON1 Solo # | Since: 2.0.2.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Solo a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Solo a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Solo a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Solo a] -> Encoding #

liftOmitField :: (a -> Bool) -> Solo a -> Bool #

ToJSON1 [] # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [a] -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [[a]] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [a] -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [[a]] -> Encoding #

liftOmitField :: (a -> Bool) -> [a] -> Bool #

ToJSONKey k => ToJSON1 (Map k) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Map k a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Map k a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Map k a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Map k a] -> Encoding #

liftOmitField :: (a -> Bool) -> Map k a -> Bool #

ToJSON a => ToJSON1 (Either a) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> Either a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [Either a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> Either a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [Either a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> Either a a0 -> Bool #

ToJSON1 (Proxy :: Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Proxy a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Proxy a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Proxy a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Proxy a] -> Encoding #

liftOmitField :: (a -> Bool) -> Proxy a -> Bool #

ToJSON a => ToJSON1 (Either a) # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> Either a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [Either a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> Either a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [Either a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> Either a a0 -> Bool #

ToJSON a => ToJSON1 (These a) # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> These a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [These a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> These a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [These a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> These a a0 -> Bool #

ToJSON a => ToJSON1 (Pair a) # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> Pair a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [Pair a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> Pair a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [Pair a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> Pair a a0 -> Bool #

ToJSON a => ToJSON1 (These a) # | Since: 1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> These a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [These a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> These a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [These a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> These a a0 -> Bool #

ToJSONKey k => ToJSON1 (HashMap k) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> HashMap k a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [HashMap k a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> HashMap k a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [HashMap k a] -> Encoding #

liftOmitField :: (a -> Bool) -> HashMap k a -> Bool #

ToJSON a => ToJSON1 ((,) a) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, a0) -> Bool #

ToJSON a => ToJSON1 (Const a :: Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> Const a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [Const a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> Const a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [Const a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> Const a a0 -> Bool #

(Generic1 f, GToJSON' Value One (Rep1 f), GToJSON' Encoding One (Rep1 f)) => ToJSON1 (Generically1 f) # | Since: 2.1.0.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Generically1 f a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Generically1 f a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Generically1 f a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Generically1 f a] -> Encoding #

liftOmitField :: (a -> Bool) -> Generically1 f a -> Bool #

ToJSON1 (Tagged a) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> Tagged a a0 -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [Tagged a a0] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> Tagged a a0 -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [Tagged a a0] -> Encoding #

liftOmitField :: (a0 -> Bool) -> Tagged a a0 -> Bool #

(ToJSON1 f, ToJSON1 g) => ToJSON1 (These1 f g) # | Since: 1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> These1 f g a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [These1 f g a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> These1 f g a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [These1 f g a] -> Encoding #

liftOmitField :: (a -> Bool) -> These1 f g a -> Bool #

(ToJSON a, ToJSON b) => ToJSON1 ((,,) a b) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, a0) -> Bool #

(ToJSON1 f, ToJSON1 g) => ToJSON1 (Product f g) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Product f g a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Product f g a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Product f g a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Product f g a] -> Encoding #

liftOmitField :: (a -> Bool) -> Product f g a -> Bool #

(ToJSON1 f, ToJSON1 g) => ToJSON1 (Sum f g) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Sum f g a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Sum f g a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Sum f g a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Sum f g a] -> Encoding #

liftOmitField :: (a -> Bool) -> Sum f g a -> Bool #

(ToJSON a, ToJSON b, ToJSON c) => ToJSON1 ((,,,) a b c) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, a0) -> Bool #

(ToJSON1 f, ToJSON1 g) => ToJSON1 (Compose f g) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> Compose f g a -> Value #

liftToJSONList :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> [Compose f g a] -> Value #

liftToEncoding :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> Compose f g a -> Encoding #

liftToEncodingList :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> [Compose f g a] -> Encoding #

liftOmitField :: (a -> Bool) -> Compose f g a -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d) => ToJSON1 ((,,,,) a b c d) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e) => ToJSON1 ((,,,,,) a b c d e) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f) => ToJSON1 ((,,,,,,) a b c d e f) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g) => ToJSON1 ((,,,,,,,) a b c d e f g) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h) => ToJSON1 ((,,,,,,,,) a b c d e f g h) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i) => ToJSON1 ((,,,,,,,,,) a b c d e f g h i) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j) => ToJSON1 ((,,,,,,,,,,) a b c d e f g h i j) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k) => ToJSON1 ((,,,,,,,,,,,) a b c d e f g h i j k) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l) => ToJSON1 ((,,,,,,,,,,,,) a b c d e f g h i j k l) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, l, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, l, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m) => ToJSON1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m, ToJSON n) => ToJSON1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) -> Value #

liftToJSONList :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0)] -> Value #

liftToEncoding :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) -> Encoding #

liftToEncodingList :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0)] -> Encoding #

liftOmitField :: (a0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, n, a0) -> Bool #

toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value #

Lift the standard `toJSON` function through the type constructor.

toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding #

Lift the standard `toEncoding` function through the type constructor.

omitField1 :: (ToJSON1 f, ToJSON a) => f a -> Bool #

class ToJSON2 (f :: Type -> Type -> Type) where #

Lifting of the `ToJSON` class to binary type constructors.

Instead of manually writing your `ToJSON2` instance, Data.Aeson.TH provides Template Haskell functions which will derive an instance at compile time.

The compiler cannot provide a default generic implementation for `liftToJSON2`, unlike `toJSON` and `liftToJSON`.

Minimal complete definition

liftToJSON2, liftToEncoding2

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> f a b -> Bool #

Since: 2.2.0.0

#### Instances

Instances details

ToJSON2 Either # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> Either a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [Either a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> Either a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [Either a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> Either a b -> Bool #

ToJSON2 Either # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> Either a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [Either a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> Either a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [Either a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> Either a b -> Bool #

ToJSON2 These # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> These a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [These a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> These a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [These a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> These a b -> Bool #

ToJSON2 Pair # | Since: 1.5.3.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> Pair a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [Pair a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> Pair a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [Pair a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> Pair a b -> Bool #

ToJSON2 These # | Since: 1.5.1.0

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> These a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [These a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> These a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [These a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> These a b -> Bool #

ToJSON2 (,) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> (a, b) -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [(a, b)] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> (a, b) -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [(a, b)] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> (a, b) -> Bool #

ToJSON2 (Const :: Type -> Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> Const a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [Const a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> Const a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [Const a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> Const a b -> Bool #

ToJSON2 (Tagged :: Type -> Type -> Type) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> Tagged a b -> Value #

liftToJSONList2 :: (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [Tagged a b] -> Value #

liftToEncoding2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> Tagged a b -> Encoding #

liftToEncodingList2 :: (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [Tagged a b] -> Encoding #

liftOmitField2 :: (a -> Bool) -> (b -> Bool) -> Tagged a b -> Bool #

ToJSON a => ToJSON2 ((,,) a) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> (a, a0, b) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b -> Bool) -> (b -> Value) -> ([b] -> Value) -> [(a, a0, b)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> (a, a0, b) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b -> Bool) -> (b -> Encoding) -> ([b] -> Encoding) -> [(a, a0, b)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b -> Bool) -> (a, a0, b) -> Bool #

(ToJSON a, ToJSON b) => ToJSON2 ((,,,) a b) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c) => ToJSON2 ((,,,,) a b c) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d) => ToJSON2 ((,,,,,) a b c d) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e) => ToJSON2 ((,,,,,,) a b c d e) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f) => ToJSON2 ((,,,,,,,) a b c d e f) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g) => ToJSON2 ((,,,,,,,,) a b c d e f g) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h) => ToJSON2 ((,,,,,,,,,) a b c d e f g h) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i) => ToJSON2 ((,,,,,,,,,,) a b c d e f g h i) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, i, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, i, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, i, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j) => ToJSON2 ((,,,,,,,,,,,) a b c d e f g h i j) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k) => ToJSON2 ((,,,,,,,,,,,,) a b c d e f g h i j k) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l) => ToJSON2 ((,,,,,,,,,,,,,) a b c d e f g h i j k l) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, l, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, l, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, l, a0, b0) -> Bool #

(ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e, ToJSON f, ToJSON g, ToJSON h, ToJSON i, ToJSON j, ToJSON k, ToJSON l, ToJSON m) => ToJSON2 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m) # |

Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0) -> Value #

liftToJSONList2 :: (a0 -> Bool) -> (a0 -> Value) -> ([a0] -> Value) -> (b0 -> Bool) -> (b0 -> Value) -> ([b0] -> Value) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0)] -> Value #

liftToEncoding2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0) -> Encoding #

liftToEncodingList2 :: (a0 -> Bool) -> (a0 -> Encoding) -> ([a0] -> Encoding) -> (b0 -> Bool) -> (b0 -> Encoding) -> ([b0] -> Encoding) -> [(a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0)] -> Encoding #

liftOmitField2 :: (a0 -> Bool) -> (b0 -> Bool) -> (a, b, c, d, e, f, g, h, i, j, k, l, m, a0, b0) -> Bool #

toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value #

Lift the standard `toJSON` function through the type constructor.

toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding #

Lift the standard `toEncoding` function through the type constructor.

omitField2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Bool #

## Generic JSON classes

class GFromJSON arity (f :: Type -> Type) #

Class of generic representation types that can be converted from JSON.

Minimal complete definition

gParseJSON

#### Instances

Instances details

GFromJSON One Par1 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser (Par1 a)
GFromJSON arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs arity a -> Value -> Parser (V1 a)
FromJSON1 f => GFromJSON One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser (Rec1 f a)
(GFromJSON' arity a, Datatype d) => GFromJSON arity (D1 d a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs arity a0 -> Value -> Parser (D1 d a a0)
FromJSON a => GFromJSON arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs arity a0 -> Value -> Parser (K1 i a a0)
(FromJSON1 f, GFromJSON One g) => GFromJSON One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser ((f :.: g) a)
GFromJSON arity a => GFromJSON arity (M1 i c a) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs arity a0 -> Value -> Parser (M1 i c a a0)

data FromArgs arity a #

A `FromArgs` value either stores nothing (for `FromJSON`) or it stores the three function arguments that decode occurrences of the type parameter (for `FromJSON1`).

type GToJSON = GToJSON' Value #

type GToEncoding = GToJSON' Encoding #

class GToJSON' enc arity (f :: Type -> Type) #

Class of generic representation types that can be converted to JSON.

Minimal complete definition

gToJSON

#### Instances

Instances details

GToJSON' enc One Par1 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc One a -> Par1 a -> enc
GToJSON' Encoding arity (U1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a -> U1 a -> Encoding
GToJSON' Encoding arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a -> V1 a -> Encoding
GToJSON' Value arity (U1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a -> U1 a -> Value
GToJSON' Value arity (V1 :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a -> V1 a -> Value
ToJSON1 f => GToJSON' Encoding One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> Rec1 f a -> Encoding
ToJSON1 f => GToJSON' Value One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> Rec1 f a -> Value
(EncodeProduct arity a, EncodeProduct arity b) => GToJSON' Encoding arity (a :*: b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a0 -> (a :*: b) a0 -> Encoding
ToJSON a => GToJSON' Encoding arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding arity a0 -> K1 i a a0 -> Encoding
(WriteProduct arity a, WriteProduct arity b, ProductSize a, ProductSize b) => GToJSON' Value arity (a :*: b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a0 -> (a :*: b) a0 -> Value
ToJSON a => GToJSON' Value arity (K1 i a :: Type -> Type) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value arity a0 -> K1 i a a0 -> Value
(AllNullary (a :+: b) allNullary, SumToJSON enc arity (a :+: b) allNullary) => GToJSON' enc arity (a :+: b) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc arity a0 -> (a :+: b) a0 -> enc
ConsToJSON enc arity a => GToJSON' enc arity (C1 c a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc arity a0 -> C1 c a a0 -> enc
(ConsToJSON enc arity a, AllNullary (C1 c a) allNullary, SumToJSON enc arity (C1 c a) allNullary) => GToJSON' enc arity (D1 d (C1 c a)) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc arity a0 -> D1 d (C1 c a) a0 -> enc
(ToJSON1 f, GToJSON' Encoding One g) => GToJSON' Encoding One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> (f :.: g) a -> Encoding
(ToJSON1 f, GToJSON' Value One g) => GToJSON' Value One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> (f :.: g) a -> Value
GToJSON' enc arity a => GToJSON' enc arity (M1 i c a) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc arity a0 -> M1 i c a a0 -> enc

data ToArgs res arity a #

A `ToArgs` value either stores nothing (for `ToJSON`) or it stores the three function arguments that encode occurrences of the type parameter (for `ToJSON1`).

data Zero #

A type-level indicator that `ToJSON` or `FromJSON` is being derived generically.

data One #

A type-level indicator that `ToJSON1` or `FromJSON1` is being derived generically.

#### Instances

Instances details

GFromJSON One Par1 # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser (Par1 a)
GToJSON' enc One Par1 # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs enc One a -> Par1 a -> enc
ToJSON1 f => GToJSON' Encoding One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> Rec1 f a -> Encoding
ToJSON1 f => GToJSON' Value One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> Rec1 f a -> Value
(ToJSON1 f, GToJSON' Encoding One g) => GToJSON' Encoding One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Encoding One a -> (f :.: g) a -> Encoding
(ToJSON1 f, GToJSON' Value One g) => GToJSON' Value One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.ToJSON Methods gToJSON :: Options -> ToArgs Value One a -> (f :.: g) a -> Value
FromJSON1 f => GFromJSON One (Rec1 f) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser (Rec1 f a)
(FromJSON1 f, GFromJSON One g) => GFromJSON One (f :.: g) # |
Instance details Defined in Data.Aeson.Types.FromJSON Methods gParseJSON :: Options -> FromArgs One a -> Value -> Parser ((f :.: g) a)

genericToJSON :: (Generic a, GToJSON' Value Zero (Rep a)) => Options -> a -> Value #

A configurable generic JSON creator. This function applied to `defaultOptions` is used as the default for `toJSON` when the type is an instance of `Generic`.

genericLiftToJSON :: (Generic1 f, GToJSON' Value One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Value) -> ([a] -> Value) -> f a -> Value #

A configurable generic JSON creator. This function applied to `defaultOptions` is used as the default for `liftToJSON` when the type is an instance of `Generic1`.

genericToEncoding :: (Generic a, GToJSON' Encoding Zero (Rep a)) => Options -> a -> Encoding #

A configurable generic JSON encoder. This function applied to `defaultOptions` is used as the default for `toEncoding` when the type is an instance of `Generic`.

genericLiftToEncoding :: (Generic1 f, GToJSON' Encoding One (Rep1 f)) => Options -> (a -> Bool) -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding #

A configurable generic JSON encoder. This function applied to `defaultOptions` is used as the default for `liftToEncoding` when the type is an instance of `Generic1`.

genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a #

A configurable generic JSON decoder. This function applied to `defaultOptions` is used as the default for `parseJSON` when the type is an instance of `Generic`.

genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> Maybe a -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) #

A configurable generic JSON decoder. This function applied to `defaultOptions` is used as the default for `liftParseJSON` when the type is an instance of `Generic1`.

# Inspecting ``Value`s`

withObject :: String -> (Object -> Parser a) -> Value -> Parser a #

``withObject` name f value` applies `f` to the `Object` when `value` is an `Object` and fails otherwise.

#### Error message example

    withObject "MyType" f (String "oops")
    -- Error: "parsing MyType failed, expected Object, but encountered String"

withText :: String -> (Text -> Parser a) -> Value -> Parser a #

``withText` name f value` applies `f` to the `Text` when `value` is a `String` and fails otherwise.

#### Error message example

    withText "MyType" f Null
    -- Error: "parsing MyType failed, expected String, but encountered Null"

withArray :: String -> (Array -> Parser a) -> Value -> Parser a #

``withArray` expected f value` applies `f` to the `Array` when `value` is an `Array` and fails otherwise.

#### Error message example

    withArray "MyType" f (String "oops")
    -- Error: "parsing MyType failed, expected Array, but encountered String"

withScientific :: String -> (Scientific -> Parser a) -> Value -> Parser a #

``withScientific` name f value` applies `f` to the `Scientific` number when `value` is a `Number` and fails using `typeMismatch` otherwise.

Warning: If you are converting from a scientific to an unbounded type such as `Integer` you may want to add a restriction on the size of the exponent (see `withBoundedScientific`) to prevent malicious input from filling up the memory of the target system.

#### Error message example

    withScientific "MyType" f (String "oops")
    -- Error: "parsing MyType failed, expected Number, but encountered String"

withBool :: String -> (Bool -> Parser a) -> Value -> Parser a #

``withBool` expected f value` applies `f` to the `Bool` when `value` is a `Boolean` and fails otherwise.

#### Error message example

    withBool "MyType" f (String "oops")
    -- Error: "parsing MyType failed, expected Boolean, but encountered String"

withEmbeddedJSON :: String -> (Value -> Parser a) -> Value -> Parser a #

Decode a nested JSON-encoded string.

pairs :: Series -> Encoding #

Encode a series of key/value pairs, separated by commas.

foldable :: (Foldable t, ToJSON a) => t a -> Encoding #

Encode a `Foldable` as a JSON array.

(.:) :: FromJSON a => Object -> Key -> Parser a #

Retrieve the value associated with the given key of an `Object`. The result is `empty` if the key is not present or the value cannot be converted to the desired type.

This accessor is appropriate if the key and value must be present in an object for it to be valid. If the key and value are optional, use `.:?` instead.

(.:?) :: FromJSON a => Object -> Key -> Parser (Maybe a) #

Retrieve the value associated with the given key of an `Object`. The result is `Nothing` if the key is not present or if its value is `Null`, or `empty` if the value cannot be converted to the desired type.

This accessor is most useful if the key and value can be absent from an object without affecting its validity. If the key and value are mandatory, use `.:` instead.

(.:!) :: FromJSON a => Object -> Key -> Parser (Maybe a) #

Retrieve the value associated with the given key of an `Object`. The result is `Nothing` if the key is not present or `empty` if the value cannot be converted to the desired type.

This differs from `.:?` by attempting to parse `Null` the same as any other JSON value, instead of interpreting it as `Nothing`.

(.!=) :: Parser (Maybe a) -> a -> Parser a #

Helper for use in combination with `.:?` to provide default values for optional JSON object fields.

This combinator is most useful if the key and value can be absent from an object without affecting its validity and we know a default value to assign in that case. If the key and value are mandatory, use `.:` instead.

Example usage:

     v1 <- o .:? "opt_field_with_dfl" .!= "default_val"
     v2 <- o .:  "mandatory_field"
     v3 <- o .:? "opt_field2"

(.:?=) :: FromJSON a => Object -> Key -> Parser a #

Retrieve the value associated with the given key of an `Object`. If the key is not present or the field is `null` and the `omittedField` is ``Just` x` for some `x`, the result will be that `x`.

Since: 2.2.0.0

(.:!=) :: FromJSON a => Object -> Key -> Parser a #

Retrieve the value associated with the given key of an `Object`. If the key is not present and the `omittedField` is ``Just` x` for some `x`, the result will be that `x`.

This differs from `.:?=` by attempting to parse `Null` the same as any other JSON value, instead of using `omittedField` when it's `Just`.

Since: 2.2.0.0

object :: [Pair] -> Value #

Create a `Value` from a list of name/value `Pair`s. If duplicate keys arise, later keys and their associated values win.

parseField :: FromJSON a => Object -> Key -> Parser a #

Function variant of `.:`.

parseFieldMaybe :: FromJSON a => Object -> Key -> Parser (Maybe a) #

Function variant of `.:?`.

parseFieldMaybe' :: FromJSON a => Object -> Key -> Parser (Maybe a) #

Function variant of `.:!`.

parseFieldOmit :: FromJSON a => Object -> Key -> Parser a #

Function variant of `.:?=`.

Since: 2.2.0.0

parseFieldOmit' :: FromJSON a => Object -> Key -> Parser a #

Function variant of `.:!=`.

Since: 2.2.0.0

explicitParseField :: (Value -> Parser a) -> Object -> Key -> Parser a #

Variant of `.:` with explicit parser function.

E.g. ``explicitParseField` `parseJSON1` :: (`FromJSON1` f, `FromJSON` a) -> `Object` -> `Text` -> `Parser` (f a)`

explicitParseFieldMaybe :: (Value -> Parser a) -> Object -> Key -> Parser (Maybe a) #

Variant of `.:?` with explicit parser function.

explicitParseFieldMaybe' :: (Value -> Parser a) -> Object -> Key -> Parser (Maybe a) #

Variant of `.:!` with explicit parser function.

explicitParseFieldOmit :: Maybe a -> (Value -> Parser a) -> Object -> Key -> Parser a #

Variant of `.:?=` with explicit arguments.

Since: 2.2.0.0

explicitParseFieldOmit' :: Maybe a -> (Value -> Parser a) -> Object -> Key -> Parser a #

Variant of `.:!=` with explicit arguments.

Since: 2.2.0.0

listEncoding :: (a -> Encoding) -> [a] -> Encoding #

Helper function to use with `liftToEncoding`. Useful when writing own `ToJSON1` instances.

    newtype F a = F [a]

    -- This instance encodes String as an array of chars
    instance ToJSON1 F where
        liftToJSON     tj _ (F xs) = liftToJSON     tj (listValue    tj) xs
        liftToEncoding te _ (F xs) = liftToEncoding te (listEncoding te) xs

    instance FromJSON1 F where
        liftParseJSON p _ v = F <$> liftParseJSON p (listParser p) v

listValue :: (a -> Value) -> [a] -> Value #

Helper function to use with `liftToJSON`, see `listEncoding`.

listParser :: (Value -> Parser a) -> Value -> Parser [a] #

Helper function to use with `liftParseJSON`. See `listEncoding`.

# Generic and TH encoding configuration

data Options #

Options that specify how to encode/decode your datatype to/from JSON.

Options can be set using record syntax on `defaultOptions` with the fields below.

#### Instances

Instances details

Show Options # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> Options -> ShowS # show :: Options -> String # showList :: [Options] -> ShowS #

## Options fields

The functions here are in fact record fields of the `Options` type.

fieldLabelModifier :: Options -> String -> String #

Function applied to field labels. Handy for removing common record prefixes for example.

constructorTagModifier :: Options -> String -> String #

Function applied to constructor tags which could be handy for lower-casing them for example.

allNullaryToStringTag :: Options -> Bool #

If `True` the constructors of a datatype, with all nullary constructors, will be encoded to just a string with the constructor tag. If `False` the encoding will always follow the `sumEncoding`.

omitNothingFields :: Options -> Bool #

If `True`, record fields with a `Nothing` value will be omitted from the resulting object. If `False`, the resulting object will include those fields mapping to `null`.

In `aeson-2.2` this flag is generalised to omit all values with ``omitField` x = True`. If `False`, the resulting object will include those fields encoded as specified.

Note that this does not affect parsing: `Maybe` fields are optional regardless of the value of `omitNothingFields`. `allowOmittedFieds` controls parsing behavior.

allowOmittedFields :: Options -> Bool #

If `True`, missing fields of a record will be filled with `omittedField` values (if they are `Just`). If `False`, all fields will required to present in the record object.

sumEncoding :: Options -> SumEncoding #

Specifies how to encode constructors of a sum datatype.

unwrapUnaryRecords :: Options -> Bool #

Hide the field name when a record constructor has only one field, like a newtype.

tagSingleConstructors :: Options -> Bool #

Encode types with a single constructor as sums, so that `allNullaryToStringTag` and `sumEncoding` apply.

rejectUnknownFields :: Options -> Bool #

Applies only to `FromJSON` instances. If a field appears in the parsed object map, but does not appear in the target object, parsing will fail, with an error message indicating which fields were unknown.

## Options utilities

data SumEncoding #

Specifies how to encode constructors of a sum datatype.

Constructors

TaggedObject

A constructor will be encoded to an object with a field `tagFieldName` which specifies the constructor tag (modified by the `constructorTagModifier`). If the constructor is a record the encoded record fields will be unpacked into this object. So make sure that your record doesn't have a field with the same label as the `tagFieldName`. Otherwise the tag gets overwritten by the encoded value of that field! If the constructor is not a record the encoded constructor contents will be stored under the `contentsFieldName` field.

Fields

- tagFieldName :: String
- contentsFieldName :: String

UntaggedValue

Constructor names won't be encoded. Instead only the contents of the constructor will be encoded as if the type had a single constructor. JSON encodings have to be disjoint for decoding to work properly.

When decoding, constructors are tried in the order of definition. If some encodings overlap, the first one defined will succeed.

Note: Nullary constructors are encoded as strings (using `constructorTagModifier`). Having a nullary constructor alongside a single field constructor that encodes to a string leads to ambiguity.

Note: Only the last error is kept when decoding, so in the case of malformed JSON, only an error for the last constructor will be reported.

ObjectWithSingleField | A constructor will be encoded to an object with a single field named after the constructor tag (modified by the `constructorTagModifier`) which maps to the encoded contents of the constructor.
TwoElemArray | A constructor will be encoded to a 2-element array where the first element is the tag of the constructor (modified by the `constructorTagModifier`) and the second element the encoded contents of the constructor.

#### Instances

Instances details

Show SumEncoding # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> SumEncoding -> ShowS # show :: SumEncoding -> String # showList :: [SumEncoding] -> ShowS #
Eq SumEncoding # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: SumEncoding -> SumEncoding -> Bool # (/=) :: SumEncoding -> SumEncoding -> Bool #

camelTo :: Char -> String -> String #

Deprecated: Use camelTo2 for better results

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"

camelTo2 :: Char -> String -> String #

Better version of `camelTo`. Example where it works better:

    camelTo '_' "CamelAPICase" == "camel_apicase"
    camelTo2 '_' "CamelAPICase" == "camel_api_case"

defaultOptions :: Options #

Default encoding `Options`:

    Options
    { fieldLabelModifier      = id
    , constructorTagModifier  = id
    , allNullaryToStringTag   = True
    , omitNothingFields       = False
    , allowOmittedFields      = True
    , sumEncoding             = defaultTaggedObject
    , unwrapUnaryRecords      = False
    , tagSingleConstructors   = False
    , rejectUnknownFields     = False
    }

defaultTaggedObject :: SumEncoding #

Default `TaggedObject` `SumEncoding` options:

    defaultTaggedObject = TaggedObject
                          { tagFieldName      = "tag"
                          , contentsFieldName = "contents"
                          }

## Options for object keys

data JSONKeyOptions #

Options for encoding keys with `genericFromJSONKey` and `genericToJSONKey`.

keyModifier :: JSONKeyOptions -> String -> String #

Function applied to keys. Its result is what goes into the encoded `Value`.

### Example

Expand

The following instances encode the constructor `Bar` to lower-case keys `"bar"`.

    data Foo = Bar
      deriving Generic

    opts :: JSONKeyOptions
    opts = defaultJSONKeyOptions { keyModifier = toLower }

    instance ToJSONKey Foo where
      toJSONKey = genericToJSONKey opts

    instance FromJSONKey Foo where
      fromJSONKey = genericFromJSONKey opts

defaultJSONKeyOptions :: JSONKeyOptions #

Default `JSONKeyOptions`:

    defaultJSONKeyOptions = JSONKeyOptions
                            { keyModifier = id
                            }

# Parsing exceptions

newtype AesonException #

Exception thrown by `throwDecode` and variants.

Since: 2.1.2.0

Constructors

AesonException String |

#### Instances

Instances details

Exception AesonException # |
Instance details Defined in Data.Aeson.Types.Internal Methods toException :: AesonException -> SomeException # fromException :: SomeException -> Maybe AesonException # displayException :: AesonException -> String # backtraceDesired :: AesonException -> Bool #
Show AesonException # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> AesonException -> ShowS # show :: AesonException -> String # showList :: [AesonException] -> ShowS #

# Parsing context

(<?>) :: Parser a -> JSONPathElement -> Parser a #

Add JSON Path context to a parser

When parsing a complex structure, it helps to annotate (sub)parsers with context, so that if an error occurs, you can find its location.

    withObject "Person" $ \o ->
      Person
        <$> o .: "name" <?> Key "name"
        <*> o .: "age"  <?> Key "age"

(Standard methods like `(.:)` already do this.)

With such annotations, if an error occurs, you will get a JSON Path location of that error.

Since 0.10

type JSONPath = [JSONPathElement] #

data JSONPathElement #

Elements of a JSON path used to describe the location of an error.

Constructors

Key Key | JSON path element of a key into an object, "object.key".
Index !Int | JSON path element of an index into an array, "array[index]".

#### Instances

Instances details

NFData JSONPathElement # |
Instance details Defined in Data.Aeson.Types.Internal Methods rnf :: JSONPathElement -> () #
Show JSONPathElement # |
Instance details Defined in Data.Aeson.Types.Internal Methods showsPrec :: Int -> JSONPathElement -> ShowS # show :: JSONPathElement -> String # showList :: [JSONPathElement] -> ShowS #
Eq JSONPathElement # |
Instance details Defined in Data.Aeson.Types.Internal Methods (==) :: JSONPathElement -> JSONPathElement -> Bool # (/=) :: JSONPathElement -> JSONPathElement -> Bool #
Ord JSONPathElement # |

Instance details

Defined in Data.Aeson.Types.Internal

Methods

compare :: JSONPathElement -> JSONPathElement -> Ordering #

(<) :: JSONPathElement -> JSONPathElement -> Bool #

(<=) :: JSONPathElement -> JSONPathElement -> Bool #

(>) :: JSONPathElement -> JSONPathElement -> Bool #

(>=) :: JSONPathElement -> JSONPathElement -> Bool #

max :: JSONPathElement -> JSONPathElement -> JSONPathElement #

min :: JSONPathElement -> JSONPathElement -> JSONPathElement #

formatPath :: JSONPath -> String #

Format a JSONPath as a `String`, representing the root object as `$`.

formatRelativePath :: JSONPath -> String #

Format a JSONPath as a `String` which represents the path relative to some root object.

formatError :: JSONPath -> String -> String #

Annotate an error message with a JSONPath error location.