maybe package:aeson-combinators

Try a decoder and get back a 'Just a' if it succeeds and Nothing if it fails. In other words, this decoder always succeeds with a 'Maybe a' value.
>>> decode (maybe string) "42"
Just Nothing

>>> decode (maybe int) "42"
Just (Just 42)
Same as key but works with omitted attributes in payloads and produces parsed values in the context of Maybe. Note that this combinator behaves differently to a combination of maybe and key, which produce error if the attribute is missing from the json object. >>> decode (maybeKey "data" int) "{}" Just Nothing
Run decoder over Value. Returns Nothing in case of failure