Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smoothdeveloper/6802703 to your computer and use it in GitHub Desktop.
Save smoothdeveloper/6802703 to your computer and use it in GitHub Desktop.
module Main where
import Data.Aeson
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import Data.Text.Encoding (decodeUtf8)
import Text.Blaze.Html (Html, preEscapedToHtml)
lazyToStrictBS :: LBS.ByteString -> BS.ByteString
lazyToStrictBS x = BS.concat $ LBS.toChunks x
toJSONText :: Value -> Html
toJSONText v = preEscapedToHtml $ decodeUtf8 $ lazyToStrictBS $ encode $ v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment