diff --git a/yesod-json/Yesod/Json.hs b/yesod-json/Yesod/Json.hs index 9a3537e8..2cf9f67a 100644 --- a/yesod-json/Yesod/Json.hs +++ b/yesod-json/Yesod/Json.hs @@ -33,9 +33,20 @@ import qualified Data.Vector as V import Text.Julius (ToJavascript (..)) import Data.Text.Lazy.Builder (fromLazyText) import Data.Text.Lazy.Encoding (decodeUtf8) +#if MIN_VERSION_aeson(0, 5, 0) +import Data.Text.Lazy.Builder (toLazyText) +import qualified Blaze.ByteString.Builder.Char.Utf8 as Blaze +#endif instance ToContent J.Value where +#if MIN_VERSION_aeson(0, 5, 0) + toContent = flip ContentBuilder Nothing + . Blaze.fromLazyText + . toLazyText + . fromValue +#else toContent = flip ContentBuilder Nothing . fromValue +#endif -- | Provide both an HTML and JSON representation for a piece of data, using -- the default layout for the HTML output ('defaultLayout'). diff --git a/yesod-json/yesod-json.cabal b/yesod-json/yesod-json.cabal index 9f41ea1e..49d3df53 100644 --- a/yesod-json/yesod-json.cabal +++ b/yesod-json/yesod-json.cabal @@ -1,5 +1,5 @@ name: yesod-json -version: 0.2.2.1 +version: 0.2.2.2 license: BSD3 license-file: LICENSE author: Michael Snoyman @@ -21,6 +21,7 @@ library , vector >= 0.9 , containers >= 0.2 && < 0.5 , unordered-containers + , blaze-builder exposed-modules: Yesod.Json ghc-options: -Wall