encode package:aeson

Efficiently serialize a JSON value as a lazy ByteString. This is implemented in terms of the ToJSON class's toEncoding method.
Efficiently serialize a JSON value as a lazy ByteString and write it to a file.
Encode to JSON according to RFC 8785 canonicalization scheme. https://datatracker.ietf.org/doc/html/rfc8785 encodeCanonical uses toJSON to produce intermediate Series, as toEncoding may (and most likely) produces non-canonical JSON. Note: decode (encodeCanonical v) === Just v for all v :: Value, i.e. encodeCanonical doesn't lose any information. However, the example in RFC8785 loses information as the intermediate number representation is Double, also current toJSON :: Double -> Value sometimes produces too precise values. For example
>>> toJSON (1e23 :: Double)
Number 9.999999999999999e22
show also behaves the same:
>>> 1e23 :: Double
9.999999999999999e22
Note: RFC8785 is not the same scheme as used in canonical-json package (https:/wiki.laptop.orggo/Canonical_JSON). That scheme produces invalid JSON (e.g. control characters encoded as is, not escaped) and cannot encode non-integral numbers.
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 fromEncoding . toEncoding (ByteString.Builder) instead. Note: Uses toJSON