mu-schema-0.1.0.0: Format-independent schemas for serialization

Safe HaskellNone
LanguageHaskell2010

Mu.Adapter.Json

Contents

Description

Just import the module and you can turn any value with a ToSchema and FromSchema from and to JSON values.

Orphan instances

Applicative w => ToSchemalessValue Value w Source # 
Instance details

Applicative w => ToSchemalessTerm Value w Source # 
Instance details

(ToJSONKey (FieldValue w sch k), ToJSON (FieldValue w sch v)) => ToJSON (FieldValue w sch (TMap k v)) Source # 
Instance details

Methods

toJSON :: FieldValue w sch (TMap k v) -> Value #

toEncoding :: FieldValue w sch (TMap k v) -> Encoding #

toJSONList :: [FieldValue w sch (TMap k v)] -> Value #

toEncodingList :: [FieldValue w sch (TMap k v)] -> Encoding #

ToJSON (FieldValue w sch t) => ToJSON (FieldValue w sch (TList t)) Source # 
Instance details

Methods

toJSON :: FieldValue w sch (TList t) -> Value #

toEncoding :: FieldValue w sch (TList t) -> Encoding #

toJSONList :: [FieldValue w sch (TList t)] -> Value #

toEncodingList :: [FieldValue w sch (TList t)] -> Encoding #

ToJSON (FieldValue w sch t) => ToJSON (FieldValue w sch (TOption t)) Source # 
Instance details

ToJSON (Term w sch (sch :/: t)) => ToJSON (FieldValue w sch (TSchematic t :: FieldTypeB Type typeName)) Source # 
Instance details

ToJSON t => ToJSON (FieldValue w sch (TPrimitive t :: FieldTypeB Type typeName)) Source # 
Instance details

ToJSON (FieldValue w sch (TNull :: FieldTypeB Type typeName)) Source # 
Instance details

ToJSONUnion w sch us => ToJSON (FieldValue w sch (TUnion us)) Source # 
Instance details

Methods

toJSON :: FieldValue w sch (TUnion us) -> Value #

toEncoding :: FieldValue w sch (TUnion us) -> Encoding #

toJSONList :: [FieldValue w sch (TUnion us)] -> Value #

toEncodingList :: [FieldValue w sch (TUnion us)] -> Encoding #

ToJSON (FieldValue w sch t) => ToJSON (Term w sch (DSimple t :: TypeDefB Type typeName fieldName)) Source # 
Instance details

Methods

toJSON :: Term w sch (DSimple t) -> Value #

toEncoding :: Term w sch (DSimple t) -> Encoding #

toJSONList :: [Term w sch (DSimple t)] -> Value #

toEncodingList :: [Term w sch (DSimple t)] -> Encoding #

ToJSONFields sch args => ToJSON (Term Identity sch (DRecord name args)) Source # 
Instance details

Methods

toJSON :: Term Identity sch (DRecord name args) -> Value #

toEncoding :: Term Identity sch (DRecord name args) -> Encoding #

toJSONList :: [Term Identity sch (DRecord name args)] -> Value #

toEncodingList :: [Term Identity sch (DRecord name args)] -> Encoding #

ToJSONEnum choices => ToJSON (Term w sch (DEnum name choices :: TypeDefB Type typeName fieldName)) Source # 
Instance details

Methods

toJSON :: Term w sch (DEnum name choices) -> Value #

toEncoding :: Term w sch (DEnum name choices) -> Encoding #

toJSONList :: [Term w sch (DEnum name choices)] -> Value #

toEncodingList :: [Term w sch (DEnum name choices)] -> Encoding #

ToJSONKey t => ToJSONKey (FieldValue w sch (TPrimitive t :: FieldTypeB Type typeName)) Source # 
Instance details

(FromJSONKey (FieldValue w sch k), FromJSON (FieldValue w sch v), Ord (FieldValue w sch k)) => FromJSON (FieldValue w sch (TMap k v)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (FieldValue w sch (TMap k v)) #

parseJSONList :: Value -> Parser [FieldValue w sch (TMap k v)] #

FromJSON (FieldValue w sch t) => FromJSON (FieldValue w sch (TList t)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (FieldValue w sch (TList t)) #

parseJSONList :: Value -> Parser [FieldValue w sch (TList t)] #

FromJSON (FieldValue w sch t) => FromJSON (FieldValue w sch (TOption t)) Source # 
Instance details

FromJSON (Term w sch (sch :/: t)) => FromJSON (FieldValue w sch (TSchematic t :: FieldTypeB Type typeName)) Source # 
Instance details

FromJSON t => FromJSON (FieldValue w sch (TPrimitive t :: FieldTypeB Type typeName)) Source # 
Instance details

FromJSON (FieldValue w sch (TNull :: FieldTypeB Type typeName)) Source # 
Instance details

FromJSONUnion w sch us => FromJSON (FieldValue w sch (TUnion us)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (FieldValue w sch (TUnion us)) #

parseJSONList :: Value -> Parser [FieldValue w sch (TUnion us)] #

FromJSON (FieldValue w sch t) => FromJSON (Term w sch (DSimple t :: TypeDefB Type typeName fieldName)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Term w sch (DSimple t)) #

parseJSONList :: Value -> Parser [Term w sch (DSimple t)] #

FromJSONFields w sch args => FromJSON (Term w sch (DRecord name args)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Term w sch (DRecord name args)) #

parseJSONList :: Value -> Parser [Term w sch (DRecord name args)] #

FromJSONEnum choices => FromJSON (Term w sch (DEnum name choices :: TypeDefB Type typeName fieldName)) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (Term w sch (DEnum name choices)) #

parseJSONList :: Value -> Parser [Term w sch (DEnum name choices)] #

FromJSONKey t => FromJSONKey (FieldValue w sch (TPrimitive t :: FieldTypeB Type typeName)) Source # 
Instance details

(ToSchema w sch sty a, ToJSON (Term w sch (sch :/: sty))) => ToJSON (WithSchema w sch sty a) Source # 
Instance details

Methods

toJSON :: WithSchema w sch sty a -> Value #

toEncoding :: WithSchema w sch sty a -> Encoding #

toJSONList :: [WithSchema w sch sty a] -> Value #

toEncodingList :: [WithSchema w sch sty a] -> Encoding #

(FromSchema w sch sty a, FromJSON (Term w sch (sch :/: sty))) => FromJSON (WithSchema w sch sty a) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (WithSchema w sch sty a) #

parseJSONList :: Value -> Parser [WithSchema w sch sty a] #