toText package:aeson

'coercing r1 r2' will evaluate to r1 if Key is Coercible to Text, and to r2 otherwise. Using coercing we can make more efficient implementations when Key is backed up by Text without exposing internals.
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 fromEncoding . toEncoding (ByteString.Builder) instead. Note: Uses toJSON