Aeson's encode function calls encodeUtf8 from the Data.Text package. That function uses unsafeDupablePerformIO and other unsafe functions to poke around in memory. That's possibly where the segfault happens.
encode
encodeUtf8
Data.Text
unsafeDupablePerformIO
See the code here.