hledger-lib-1.32.3: A library providing the core functionality of hledger

Safe Haskell | Safe-Inferred
Language | Haskell2010

Hledger.Data.Json

Contents

- Instances
- Utilities
- Orphan instances

Synopsis

- toJsonText :: ToJSON a => a -> Text
- writeJsonFile :: ToJSON a => FilePath -> a -> IO ()
- readJsonFile :: FromJSON a => FilePath -> IO a

# Instances

# Utilities

toJsonText :: ToJSON a => a -> Text Source #

Show a JSON-convertible haskell value as pretty-printed JSON text.

writeJsonFile :: ToJSON a => FilePath -> a -> IO () Source #

Write a JSON-convertible haskell value to a pretty-printed JSON file. Eg: writeJsonFile "a.json" nulltransaction

readJsonFile :: FromJSON a => FilePath -> IO a Source #

Read a JSON file and decode it to the target type, or raise an error if we can't. Eg: readJsonFile "a.json" :: IO Transaction

# Orphan instances

FromJSON Account Source # |
Instance details Methods parseJSON :: Value -> Parser Account Source # parseJSONList :: Value -> Parser [Account] Source #
FromJSON AccountDeclarationInfo Source # |
Instance details Methods parseJSON :: Value -> Parser AccountDeclarationInfo Source # parseJSONList :: Value -> Parser [AccountDeclarationInfo] Source #
FromJSON Amount Source # |
Instance details Methods parseJSON :: Value -> Parser Amount Source # parseJSONList :: Value -> Parser [Amount] Source #
FromJSON AmountPrecision Source # |
Instance details Methods parseJSON :: Value -> Parser AmountPrecision Source # parseJSONList :: Value -> Parser [AmountPrecision] Source #
FromJSON AmountPrice Source # |
Instance details Methods parseJSON :: Value -> Parser AmountPrice Source # parseJSONList :: Value -> Parser [AmountPrice] Source #
FromJSON AmountStyle Source # |
Instance details Methods parseJSON :: Value -> Parser AmountStyle Source # parseJSONList :: Value -> Parser [AmountStyle] Source #
FromJSON BalanceAssertion Source # |
Instance details Methods parseJSON :: Value -> Parser BalanceAssertion Source # parseJSONList :: Value -> Parser [BalanceAssertion] Source #
FromJSON DigitGroupStyle Source # |
Instance details Methods parseJSON :: Value -> Parser DigitGroupStyle Source # parseJSONList :: Value -> Parser [DigitGroupStyle] Source #
FromJSON MarketPrice Source # |
Instance details Methods parseJSON :: Value -> Parser MarketPrice Source # parseJSONList :: Value -> Parser [MarketPrice] Source #
FromJSON MixedAmount Source # |
Instance details Methods parseJSON :: Value -> Parser MixedAmount Source # parseJSONList :: Value -> Parser [MixedAmount] Source #
FromJSON Posting Source # |
Instance details Methods parseJSON :: Value -> Parser Posting Source # parseJSONList :: Value -> Parser [Posting] Source #
FromJSON PostingType Source # |
Instance details Methods parseJSON :: Value -> Parser PostingType Source # parseJSONList :: Value -> Parser [PostingType] Source #
FromJSON Rounding Source # |
Instance details Methods parseJSON :: Value -> Parser Rounding Source # parseJSONList :: Value -> Parser [Rounding] Source #
FromJSON Side Source # |
Instance details Methods parseJSON :: Value -> Parser Side Source # parseJSONList :: Value -> Parser [Side] Source #
FromJSON Status Source # |
Instance details Methods parseJSON :: Value -> Parser Status Source # parseJSONList :: Value -> Parser [Status] Source #
FromJSON Transaction Source # |
Instance details Methods parseJSON :: Value -> Parser Transaction Source # parseJSONList :: Value -> Parser [Transaction] Source #
FromJSON Pos Source # |
Instance details Methods parseJSON :: Value -> Parser Pos Source # parseJSONList :: Value -> Parser [Pos] Source #
FromJSON SourcePos Source # |
Instance details Methods parseJSON :: Value -> Parser SourcePos Source # parseJSONList :: Value -> Parser [SourcePos] Source #
ToJSON Account Source # |
Instance details Methods toJSON :: Account -> Value Source # toEncoding :: Account -> Encoding Source # toJSONList :: [Account] -> Value Source # toEncodingList :: [Account] -> Encoding Source #
ToJSON AccountAlias Source # |
Instance details Methods toJSON :: AccountAlias -> Value Source # toEncoding :: AccountAlias -> Encoding Source # toJSONList :: [AccountAlias] -> Value Source # toEncodingList :: [AccountAlias] -> Encoding Source #
ToJSON AccountDeclarationInfo Source # |
Instance details Methods toJSON :: AccountDeclarationInfo -> Value Source # toEncoding :: AccountDeclarationInfo -> Encoding Source # toJSONList :: [AccountDeclarationInfo] -> Value Source # toEncodingList :: [AccountDeclarationInfo] -> Encoding Source #
ToJSON AccountType Source # |
Instance details Methods toJSON :: AccountType -> Value Source # toEncoding :: AccountType -> Encoding Source # toJSONList :: [AccountType] -> Value Source # toEncodingList :: [AccountType] -> Encoding Source #
ToJSON Amount Source # |
Instance details Methods toJSON :: Amount -> Value Source # toEncoding :: Amount -> Encoding Source # toJSONList :: [Amount] -> Value Source # toEncodingList :: [Amount] -> Encoding Source #
ToJSON AmountPrecision Source # |
Instance details Methods toJSON :: AmountPrecision -> Value Source # toEncoding :: AmountPrecision -> Encoding Source # toJSONList :: [AmountPrecision] -> Value Source # toEncodingList :: [AmountPrecision] -> Encoding Source #
ToJSON AmountPrice Source # |
Instance details Methods toJSON :: AmountPrice -> Value Source # toEncoding :: AmountPrice -> Encoding Source # toJSONList :: [AmountPrice] -> Value Source # toEncodingList :: [AmountPrice] -> Encoding Source #
ToJSON AmountStyle Source # |
Instance details Methods toJSON :: AmountStyle -> Value Source # toEncoding :: AmountStyle -> Encoding Source # toJSONList :: [AmountStyle] -> Value Source # toEncodingList :: [AmountStyle] -> Encoding Source #
ToJSON BalanceAssertion Source # |
Instance details Methods toJSON :: BalanceAssertion -> Value Source # toEncoding :: BalanceAssertion -> Encoding Source # toJSONList :: [BalanceAssertion] -> Value Source # toEncodingList :: [BalanceAssertion] -> Encoding Source #
ToJSON Commodity Source # |
Instance details Methods toJSON :: Commodity -> Value Source # toEncoding :: Commodity -> Encoding Source # toJSONList :: [Commodity] -> Value Source # toEncodingList :: [Commodity] -> Encoding Source #
ToJSON DateSpan Source # |
Instance details Methods toJSON :: DateSpan -> Value Source # toEncoding :: DateSpan -> Encoding Source # toJSONList :: [DateSpan] -> Value Source # toEncodingList :: [DateSpan] -> Encoding Source #
ToJSON DigitGroupStyle Source # |
Instance details Methods toJSON :: DigitGroupStyle -> Value Source # toEncoding :: DigitGroupStyle -> Encoding Source # toJSONList :: [DigitGroupStyle] -> Value Source # toEncodingList :: [DigitGroupStyle] -> Encoding Source #
ToJSON EFDay Source # |
Instance details Methods toJSON :: EFDay -> Value Source # toEncoding :: EFDay -> Encoding Source # toJSONList :: [EFDay] -> Value Source # toEncodingList :: [EFDay] -> Encoding Source #
ToJSON Interval Source # |
Instance details Methods toJSON :: Interval -> Value Source # toEncoding :: Interval -> Encoding Source # toJSONList :: [Interval] -> Value Source # toEncodingList :: [Interval] -> Encoding Source #
ToJSON Journal Source # |
Instance details Methods toJSON :: Journal -> Value Source # toEncoding :: Journal -> Encoding Source # toJSONList :: [Journal] -> Value Source # toEncodingList :: [Journal] -> Encoding Source #
ToJSON Ledger Source # |
Instance details Methods toJSON :: Ledger -> Value Source # toEncoding :: Ledger -> Encoding Source # toJSONList :: [Ledger] -> Value Source # toEncodingList :: [Ledger] -> Encoding Source #
ToJSON MarketPrice Source # |
Instance details Methods toJSON :: MarketPrice -> Value Source # toEncoding :: MarketPrice -> Encoding Source # toJSONList :: [MarketPrice] -> Value Source # toEncodingList :: [MarketPrice] -> Encoding Source #
ToJSON MixedAmount Source # |
Instance details Methods toJSON :: MixedAmount -> Value Source # toEncoding :: MixedAmount -> Encoding Source # toJSONList :: [MixedAmount] -> Value Source # toEncodingList :: [MixedAmount] -> Encoding Source #
ToJSON PayeeDeclarationInfo Source # |
Instance details Methods toJSON :: PayeeDeclarationInfo -> Value Source # toEncoding :: PayeeDeclarationInfo -> Encoding Source # toJSONList :: [PayeeDeclarationInfo] -> Value Source # toEncodingList :: [PayeeDeclarationInfo] -> Encoding Source #
ToJSON Period Source # |
Instance details Methods toJSON :: Period -> Value Source # toEncoding :: Period -> Encoding Source # toJSONList :: [Period] -> Value Source # toEncodingList :: [Period] -> Encoding Source #
ToJSON PeriodicTransaction Source # |
Instance details Methods toJSON :: PeriodicTransaction -> Value Source # toEncoding :: PeriodicTransaction -> Encoding Source # toJSONList :: [PeriodicTransaction] -> Value Source # toEncodingList :: [PeriodicTransaction] -> Encoding Source #
ToJSON Posting Source # |
Instance details Methods toJSON :: Posting -> Value Source # toEncoding :: Posting -> Encoding Source # toJSONList :: [Posting] -> Value Source # toEncodingList :: [Posting] -> Encoding Source #
ToJSON PostingType Source # |
Instance details Methods toJSON :: PostingType -> Value Source # toEncoding :: PostingType -> Encoding Source # toJSONList :: [PostingType] -> Value Source # toEncodingList :: [PostingType] -> Encoding Source #
ToJSON PriceDirective Source # |
Instance details Methods toJSON :: PriceDirective -> Value Source # toEncoding :: PriceDirective -> Encoding Source # toJSONList :: [PriceDirective] -> Value Source # toEncodingList :: [PriceDirective] -> Encoding Source #
ToJSON Rounding Source # |
Instance details Methods toJSON :: Rounding -> Value Source # toEncoding :: Rounding -> Encoding Source # toJSONList :: [Rounding] -> Value Source # toEncodingList :: [Rounding] -> Encoding Source #
ToJSON Side Source # |
Instance details Methods toJSON :: Side -> Value Source # toEncoding :: Side -> Encoding Source # toJSONList :: [Side] -> Value Source # toEncodingList :: [Side] -> Encoding Source #
ToJSON Status Source # |
Instance details Methods toJSON :: Status -> Value Source # toEncoding :: Status -> Encoding Source # toJSONList :: [Status] -> Value Source # toEncodingList :: [Status] -> Encoding Source #
ToJSON TMPostingRule Source # |
Instance details Methods toJSON :: TMPostingRule -> Value Source # toEncoding :: TMPostingRule -> Encoding Source # toJSONList :: [TMPostingRule] -> Value Source # toEncodingList :: [TMPostingRule] -> Encoding Source #
ToJSON TagDeclarationInfo Source # |
Instance details Methods toJSON :: TagDeclarationInfo -> Value Source # toEncoding :: TagDeclarationInfo -> Encoding Source # toJSONList :: [TagDeclarationInfo] -> Value Source # toEncodingList :: [TagDeclarationInfo] -> Encoding Source #
ToJSON TimeclockCode Source # |
Instance details Methods toJSON :: TimeclockCode -> Value Source # toEncoding :: TimeclockCode -> Encoding Source # toJSONList :: [TimeclockCode] -> Value Source # toEncodingList :: [TimeclockCode] -> Encoding Source #
ToJSON TimeclockEntry Source # |
Instance details Methods toJSON :: TimeclockEntry -> Value Source # toEncoding :: TimeclockEntry -> Encoding Source # toJSONList :: [TimeclockEntry] -> Value Source # toEncodingList :: [TimeclockEntry] -> Encoding Source #
ToJSON Transaction Source # |
Instance details Methods toJSON :: Transaction -> Value Source # toEncoding :: Transaction -> Encoding Source # toJSONList :: [Transaction] -> Value Source # toEncodingList :: [Transaction] -> Encoding Source #
ToJSON TransactionModifier Source # |
Instance details Methods toJSON :: TransactionModifier -> Value Source # toEncoding :: TransactionModifier -> Encoding Source # toJSONList :: [TransactionModifier] -> Value Source # toEncodingList :: [TransactionModifier] -> Encoding Source #
ToJSON Pos Source # |
Instance details Methods toJSON :: Pos -> Value Source # toEncoding :: Pos -> Encoding Source # toJSONList :: [Pos] -> Value Source # toEncodingList :: [Pos] -> Encoding Source #
ToJSON SourcePos Source # |
Instance details Methods toJSON :: SourcePos -> Value Source # toEncoding :: SourcePos -> Encoding Source # toJSONList :: [SourcePos] -> Value Source # toEncodingList :: [SourcePos] -> Encoding Source #
ToJSONKey AccountType Source # |
Instance details Methods toJSONKey :: ToJSONKeyFunction AccountType Source # toJSONKeyList :: ToJSONKeyFunction [AccountType] Source #
FromJSON (DecimalRaw Integer) Source # |
Instance details Methods parseJSON :: Value -> Parser (DecimalRaw Integer) Source # parseJSONList :: Value -> Parser [DecimalRaw Integer] Source #
(Integral a, ToJSON a) => ToJSON (DecimalRaw a) Source # |
Instance details Methods toJSON :: DecimalRaw a -> Value Source # toEncoding :: DecimalRaw a -> Encoding Source # toJSONList :: [DecimalRaw a] -> Value Source # toEncodingList :: [DecimalRaw a] -> Encoding Source #