Module

HTTPurple.Json

Package
purescript-httpurple
Repository
sigma-andex/purescript-httpurple

#JsonDecoder Source

newtype JsonDecoder err json

Constructors

Instances

#JsonEncoder Source

newtype JsonEncoder json

Constructors

Instances

#fromJson Source

fromJson :: forall (err :: Type) (json :: Type) (m :: Type -> Type). MonadAff m => JsonDecoder err json -> RequestBody -> ContT Response m json

Parse the RequestBody as json using the provided JsonDecoder. If it fails, an empty bad request is returned Returns a continuation

#fromJsonE Source

fromJsonE :: forall (err :: Type) (json :: Type) (m :: Type -> Type). MonadAff m => JsonDecoder err json -> (err -> m Response) -> RequestBody -> ContT Response m json

Parse the RequestBody as json using the provided JsonDecoder. If it fails, the error handler is called. Returns a continuation

#toJson Source

toJson :: forall (json :: Type). JsonEncoder json -> json -> String

Serialise a type to json using the given driver.