{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FunctionalDependencies #-} -- | Pretty-printing JSON values. module Text.JSON.JSONPrint ( JSONPrint(..) ) where import Data.ByteString import Text.JSONb import qualified Text.JSON as J import qualified Text.HJson as H import Text.JSON.Pretty import Text.HJson.Pretty -- | Pretty-printing JSON values. class JSONPrint j s | j -> s where -- | Print the given JSON value to a pretty-printed value. printJSON :: j -- ^ The JSON value. -> s -- ^ The pretty-printed result. instance JSONPrint JSON ByteString where printJSON = encode Compact instance JSONPrint J.JSValue [Char] where printJSON = render . pp_value instance JSONPrint H.Json [Char] where printJSON = toString " "