module Rattletrap.Utility.Json ( module Rattletrap.Utility.Json , Aeson.FromJSON(parseJSON) , Aeson.ToJSON(toJSON) , Aeson.Value , Aeson.encode , Aeson.object , Aeson.withObject , Aeson.withText ) where import qualified Data.Aeson as Aeson import qualified Data.Aeson.Encode.Pretty as Aeson import qualified Data.Aeson.Types as Aeson import qualified Data.ByteString as ByteString import qualified Data.ByteString.Lazy as LazyByteString import qualified Data.Text as Text required :: Aeson.FromJSON value => Aeson.Object -> String -> Aeson.Parser value required :: Object -> String -> Parser value required Object object String key = Object object Object -> Text -> Parser value forall a. FromJSON a => Object -> Text -> Parser a Aeson..: String -> Text Text.pack String key optional :: Aeson.FromJSON value => Aeson.Object -> String -> Aeson.Parser (Maybe value) optional :: Object -> String -> Parser (Maybe value) optional Object object String key = Object object Object -> Text -> Parser (Maybe value) forall a. FromJSON a => Object -> Text -> Parser (Maybe a) Aeson..:? String -> Text Text.pack String key pair :: (Aeson.ToJSON value, Aeson.KeyValue pair) => String -> value -> pair pair :: String -> value -> pair pair String key value value = String -> Text Text.pack String key Text -> value -> pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Aeson..= value value decode :: Aeson.FromJSON a => ByteString.ByteString -> Either String a decode :: ByteString -> Either String a decode = ByteString -> Either String a forall a. FromJSON a => ByteString -> Either String a Aeson.eitherDecodeStrict' encodePretty :: Aeson.ToJSON a => a -> LazyByteString.ByteString encodePretty :: a -> ByteString encodePretty = Config -> a -> ByteString forall a. ToJSON a => Config -> a -> ByteString Aeson.encodePretty' Config Aeson.defConfig { confCompare :: Text -> Text -> Ordering Aeson.confCompare = Text -> Text -> Ordering forall a. Ord a => a -> a -> Ordering compare , confIndent :: Indent Aeson.confIndent = Indent Aeson.Tab , confTrailingNewline :: Bool Aeson.confTrailingNewline = Bool True }