imp: json: Decrease indentation in JSON output.

This commit is contained in:
Stephen Morgan 2021-07-21 16:42:15 +10:00 committed by Simon Michael
parent a291f5d33b
commit 58516eea77
2 changed files with 94 additions and 94 deletions

View File

@ -261,7 +261,7 @@ instance FromJSON (DecimalRaw Integer)
-- | Config for pretty printing JSON output. -- | Config for pretty printing JSON output.
jsonConf :: Config jsonConf :: Config
jsonConf = Config{confIndent=Spaces 4,confCompare=compare, confNumFormat=Generic, confTrailingNewline=True} jsonConf = Config{confIndent=Spaces 2, confCompare=compare, confNumFormat=Generic, confTrailingNewline=True}
-- | Show a JSON-convertible haskell value as pretty-printed JSON text. -- | Show a JSON-convertible haskell value as pretty-printed JSON text.
toJsonText :: ToJSON a => a -> TL.Text toJsonText :: ToJSON a => a -> TL.Text

View File

@ -5,111 +5,111 @@
# 1. Test the json output for register reports # 1. Test the json output for register reports
$ hledger -f- reg --output-format=json $ hledger -f- reg --output-format=json
[ [
[ [
"2019-01-01", "2019-01-01",
null, null,
"", "",
{
"paccount": "a",
"pamount": [
{ {
"paccount": "a", "acommodity": "AAA",
"pamount": [ "aismultiplier": false,
{ "aprice": null,
"acommodity": "AAA", "aquantity": {
"aismultiplier": false, "decimalMantissa": 10,
"aprice": null, "decimalPlaces": 1,
"aquantity": { "floatingPoint": 1
"decimalMantissa": 10, },
"decimalPlaces": 1, "astyle": {
"floatingPoint": 1 "ascommodityside": "R",
}, "ascommodityspaced": true,
"astyle": { "asdecimalpoint": ".",
"ascommodityside": "R", "asdigitgroups": null,
"ascommodityspaced": true, "asprecision": 1
"asdecimalpoint": ".", }
"asdigitgroups": null, }
"asprecision": 1 ],
} "pbalanceassertion": null,
} "pcomment": "",
], "pdate": null,
"pbalanceassertion": null, "pdate2": null,
"pcomment": "", "poriginal": null,
"pdate": null, "pstatus": "Unmarked",
"pdate2": null, "ptags": [],
"poriginal": null, "ptransaction_": "1",
"pstatus": "Unmarked", "ptype": "VirtualPosting"
"ptags": [], },
"ptransaction_": "1", [
"ptype": "VirtualPosting" {
"acommodity": "AAA",
"aismultiplier": false,
"aprice": null,
"aquantity": {
"decimalMantissa": 10,
"decimalPlaces": 1,
"floatingPoint": 1
}, },
[ "astyle": {
{ "ascommodityside": "R",
"acommodity": "AAA", "ascommodityspaced": true,
"aismultiplier": false, "asdecimalpoint": ".",
"aprice": null, "asdigitgroups": null,
"aquantity": { "asprecision": 1
"decimalMantissa": 10, }
"decimalPlaces": 1, }
"floatingPoint": 1
},
"astyle": {
"ascommodityside": "R",
"ascommodityspaced": true,
"asdecimalpoint": ".",
"asdigitgroups": null,
"asprecision": 1
}
}
]
] ]
]
] ]
# 2. Test the json output for balance reports # 2. Test the json output for balance reports
$ hledger -f- bal --output-format=json $ hledger -f- bal --output-format=json
[ [
[
[ [
[ "a",
"a", "a",
"a", 0,
0, [
[
{
"acommodity": "AAA",
"aismultiplier": false,
"aprice": null,
"aquantity": {
"decimalMantissa": 10,
"decimalPlaces": 1,
"floatingPoint": 1
},
"astyle": {
"ascommodityside": "R",
"ascommodityspaced": true,
"asdecimalpoint": ".",
"asdigitgroups": null,
"asprecision": 1
}
}
]
]
],
[
{ {
"acommodity": "AAA", "acommodity": "AAA",
"aismultiplier": false, "aismultiplier": false,
"aprice": null, "aprice": null,
"aquantity": { "aquantity": {
"decimalMantissa": 10, "decimalMantissa": 10,
"decimalPlaces": 1, "decimalPlaces": 1,
"floatingPoint": 1 "floatingPoint": 1
}, },
"astyle": { "astyle": {
"ascommodityside": "R", "ascommodityside": "R",
"ascommodityspaced": true, "ascommodityspaced": true,
"asdecimalpoint": ".", "asdecimalpoint": ".",
"asdigitgroups": null, "asdigitgroups": null,
"asprecision": 1 "asprecision": 1
} }
} }
]
] ]
],
[
{
"acommodity": "AAA",
"aismultiplier": false,
"aprice": null,
"aquantity": {
"decimalMantissa": 10,
"decimalPlaces": 1,
"floatingPoint": 1
},
"astyle": {
"ascommodityside": "R",
"ascommodityspaced": true,
"asdecimalpoint": ".",
"asdigitgroups": null,
"asprecision": 1
}
}
]
] ]
>=0 >=0