| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.Digestive.Aeson
Description
Run digestive-functors forms against JSON.
Synopsis
- digestJSON :: Monad m => Form v m a -> Value -> m (View v, Maybe a)
- jsonErrors :: ToJSON a => View a -> Value
Documentation
Arguments
| :: Monad m | |
| => Form v m a | The form to evaluate. |
| -> Value | The JSON document to use for validation. If you need to use
only part of this document, you need to transform this value
first. You may find the |
| -> m (View v, Maybe a) |
Given a JSON document and a form, attempt to use the JSON document to
evaluation the form. If the form fails validation, then Nothing is
returned.
Example:
import Data.Aeson (json)
import Data.Attoparsec.Lazy (parse, maybeResult)
import Text.Digestive.Aeson (digestJSON)
...
Just parsedJson <- maybeResult . parse json <$> fetchJsonText
digestJSON myForm parsedJson