Encode a JSON Value to a Data.Text.Lazy
Note: uses toEncoding
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Moduleaeson-2.2.3.0Haskell2010
Most frequently, you'll probably want to encode straight to UTF-8
(the standard JSON encoding) using encode.
You can use the conversions to Builders when embedding JSON messages as parts of a protocol.
Encode a JSON Value to a Data.Text.Lazy
Note: uses toEncoding
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
L.ByteString, it is more efficient to use encode (lazy ByteString)
or (ByteString.Builder) instead.fromEncoding . toEncoding
Note: Uses toJSON