Copyright | (c) 2012-2016 Bryan O'Sullivan (c) 2011 MailRank Inc. |
---|---|
License | BSD3 |
Maintainer | Bryan O'Sullivan <bos@serpentine.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Most frequently, you'll probably want to encode straight to UTF-8
(the standard JSON encoding) using encode
.
You can use the conversions to Builder
s when embedding JSON messages as
parts of a protocol.
Synopsis
- encodeToLazyText :: ToJSON a => a -> Text
- encodeToTextBuilder :: ToJSON a => a -> Builder
Documentation
encodeToLazyText :: ToJSON a => a -> Text Source #
Encode a JSON Value
to a Data.Text.Lazy
Note: uses toEncoding
encodeToTextBuilder :: ToJSON a => a -> Builder Source #
Encode a JSON Value
to a Data.Text Builder
, which can be
embedded efficiently in a text-based protocol.
If you are going to immediately encode straight to a
ByteString
, it is more efficient to use encode
(lazy ByteString)
or
(ByteString.Builder) instead.fromEncoding
. toEncoding
Note: Uses toJSON