simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
3.07k stars 320 forks source link

more machine readable output (CSV, JSON..) #1099

Open sbridges opened 5 years ago

sbridges commented 5 years ago

In regards to,

https://github.com/sbridges/ledgerble/commit/2cb299f7dbdcbe360d765eb8073da890056ea84d#r35514963

It would be nice to have an easily machine readable output from hledger. The current csv format inconsistently formats values, and doesn't separate the currency from the value.

Having the account type for each entry would also be very useful.

simonmichael commented 5 years ago

Thanks @sbridges. Some notes:

Use cases

  1. Sometimes you want amounts as they are displayed in reports - I’ll call these “human readable amounts”. Eg you are importing a balance report into a spreadsheet, you want the currency symbol attached so it knows they are money.
  2. Sometimes you want machine readable numbers in a standard format - eg period decimal mark, no digit group mark - and the currency symbol separated. Eg for reading by other software like ledgerble.
  3. Sometimes you may want something in between.

Notes

Ideas

More machine-readable numbers

Signalling multicommodity amounts

Representing multicommodity amounts

UI

sbridges commented 5 years ago

The machine parseable output might be better as json. When the number of column in the csv get to be dynamic, a json map may be better.

simonmichael commented 5 years ago

You're probably right. I think the CSV should do at least a little better here also. CSV is nice for its simplicity.