Hledger.Data.Json

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

Safe Haskell | None
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 #

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

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

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

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

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