module Data.Aeson.Extended where
import Data.Aeson (ToJSON)
import qualified Data.Aeson.Encode.Pretty as AesonPretty
import qualified Data.ByteString.Lazy as BL
encodeFilePretty :: (ToJSON a) => FilePath -> a -> IO ()
encodeFilePretty :: forall a. ToJSON a => FilePath -> a -> IO ()
encodeFilePretty FilePath
fp = FilePath -> ByteString -> IO ()
BL.writeFile FilePath
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. ToJSON a => Config -> a -> ByteString
AesonPretty.encodePretty' Config
config
where
config :: Config
config =
Config
AesonPretty.defConfig
{ confTrailingNewline :: Bool
AesonPretty.confTrailingNewline = Bool
True,
confCompare :: Text -> Text -> Ordering
AesonPretty.confCompare = forall a. Ord a => a -> a -> Ordering
compare
}