You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using encode on this data type, I correctly get {"name": ..., "age": ...}. But using encodePretty instead gives me {"_name": ..., "_age": ...}.
I think this is because the underlying encodePrettyToTextBuilder' calls toJSON directly, which does not apply the encoding options. If possible, it'd be great to preserve the options when using encodePretty.
The text was updated successfully, but these errors were encountered:
encodePretty :: ToJSON a => a -> ByteString
A drop-in replacement for aeson's encode function
One would then expect that it uses the same function as encode, which is toEncoding, whereas encodePretty uses toJSON. The name *encode*Pretty is misleading too.
It doesn't appear that
encodePretty
or any of the other variants of that function respect custom encoding options defined intoEncoding
.Small example:
Using
encode
on this data type, I correctly get{"name": ..., "age": ...}
. But usingencodePretty
instead gives me{"_name": ..., "_age": ...}
.I think this is because the underlying
encodePrettyToTextBuilder'
callstoJSON
directly, which does not apply the encoding options. If possible, it'd be great to preserve the options when usingencodePretty
.The text was updated successfully, but these errors were encountered: