Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- getBoundedJSON :: (MonadSnap m, FromJSON a) => Int64 -> m (Either String a)
- getJSON :: (MonadSnap m, FromJSON a) => m (Either String a)
- reqBoundedJSON :: (MonadSnap m, FromJSON a) => Int64 -> m a
- reqJSON :: (MonadSnap m, FromJSON b) => m b
- getJSONField :: (MonadSnap m, FromJSON a) => ByteString -> m (Either String a)
- reqJSONField :: (MonadSnap m, FromJSON a) => ByteString -> m a
- writeJSON :: (MonadSnap m, ToJSON a) => a -> m ()
Parsing JSON from Request Body
Parse request body into JSON or return an error string.
getJSON :: (MonadSnap m, FromJSON a) => m (Either String a) Source #
Try to parse request body as JSON with a default max size of 50000.
Demand the presence of JSON in the body with a size up to N bytes. If parsing fails for any reson, request is terminated early and a server error is returned.
reqJSON :: (MonadSnap m, FromJSON b) => m b Source #
Demand the presence of JSON in the body assuming it is not larger than 50000 bytes.
getJSONField :: (MonadSnap m, FromJSON a) => ByteString -> m (Either String a) Source #
Get JSON data from the given Param field
reqJSONField :: (MonadSnap m, FromJSON a) => ByteString -> m a Source #
Force the JSON value from field. Similar to getJSONField