-
Notifications
You must be signed in to change notification settings - Fork 177
Description
When I run a command like this:
tabulate --format github - <<"EOF"
[
{
"column1": "data",
"column2": 123,
"column3": true,
"column4": null
},
{
"column1": "Longer string",
"column2": 123,
"column3": true,
"column4": null
}
]
EOFI expect output like this:
| column1 | column2 | column3 | column4 |
|---------------|-----------|-----------|-----------|
| data | 123 | True | |
| Longer string | 123 | True | |
Unfortunately I get output like this:
|---|------------|---------|----------|
| [ | | | |
| | { | | |
| | "column1": | "data", | |
| | "column2": | 123, | |
| | "column3": | true, | |
| | "column4": | null | |
| | }, | | |
| | { | | |
| | "column1": | "Longer | string", |
| | "column2": | 123, | |
| | "column3": | true, | |
| | "column4": | null | |
| | } | | |
| ] | | | |
In the README for the command-line utility I don't see any input format options or an expected input format.
As a library the README says tabulate supports "list or another iterable of dicts (keys as columns)". This matches my use case as it's what you would get after converting the input to via json.load
Am I missing something?
If not, would you consider supporting this use case?
Currently I use jtbl for this (kellyjonbrazil/jtbl#9) but I'd like tabulate to support it too as it has even more useful formatting options.
If it's not possible to guess the input format I'd accept something like an --input-format json similar to in2csv's --format json option.