mu-schema-0.3.1.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

ToSchemalessValue Value Source # 
Instance details

ToSchemalessTerm Value Source # 
Instance details

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

Methods

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

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

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

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

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

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

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

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

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

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

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

Methods

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

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

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

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

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

Methods

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

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

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

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

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

Methods

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

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

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

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

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

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

Methods

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

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

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

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

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

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

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

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

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

Methods

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

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

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

Methods

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

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

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

Methods

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

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

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

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

Methods

toJSON :: WithSchema sch sty a -> Value #

toEncoding :: WithSchema sch sty a -> Encoding #

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

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

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

Methods

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

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