Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Convertion to and from aeson
Value
.
Synopsis
- decode :: FromJSON a => ByteString -> Maybe a
- eitherDecode :: FromJSON a => ByteString -> Either String a
- throwDecode :: forall a m. (FromJSON a, MonadThrow m) => ByteString -> m a
- decodeStrict :: FromJSON a => ByteString -> Maybe a
- eitherDecodeStrict :: FromJSON a => ByteString -> Either String a
- throwDecodeStrict :: forall a m. (FromJSON a, MonadThrow m) => ByteString -> m a
- toEitherValue :: Tokens k e -> Either e (Value, k)
- unescapeText :: ByteString -> Either UnicodeException Text
Documentation
decode :: FromJSON a => ByteString -> Maybe a Source #
Efficiently deserialize a JSON value from a strict ByteString
.
If this fails due to incomplete or invalid input, Nothing
is
returned.
eitherDecode :: FromJSON a => ByteString -> Either String a Source #
Like decodeStrict
but returns an error message when decoding fails.
throwDecode :: forall a m. (FromJSON a, MonadThrow m) => ByteString -> m a Source #
Like decode
but throws an AesonException
when decoding fails.
throwDecode
is in aeson
since 2.1.2.0, but this variant is added later.
decodeStrict :: FromJSON a => ByteString -> Maybe a Source #
Efficiently deserialize a JSON value from a strict ByteString
.
If this fails due to incomplete or invalid input, Nothing
is
returned.
eitherDecodeStrict :: FromJSON a => ByteString -> Either String a Source #
Like decodeStrict
but returns an error message when decoding fails.
throwDecodeStrict :: forall a m. (FromJSON a, MonadThrow m) => ByteString -> m a Source #
Like decodeStrict
but throws an AesonException
when decoding fails.
unescapeText :: ByteString -> Either UnicodeException Text Source #
Unescape JSON text literal.
This function is exporeted mostly for testing and benchmarking purposes.