Encode a JSON Value to a Data.Text.Lazy
Note: uses toEncoding
:: a typeCtrl KGHC 10.0.0.20260917 · lts/ghc-10.0.x · aa25b89 · 2026-10-10
Moduleaeson-2.3.2.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
ByteString, it is more efficient to use encode (lazy ByteString)
or (Builder) instead.Data.Aeson.fromEncoding . toEncoding
Note: Uses toJSON