André Stemmet c99ad5a7bd | ||
---|---|---|
test | ||
.gitignore | ||
LICENSE | ||
README.md | ||
j2tn.pl |
README.md
j2tn
Prototype for a semi-normalized way to convert a nested JSON document to CSV
Requirements
You will need to install the following Perl modules
- YAML
- JSON
- Text::CSV_XS
For most operating systems this can be achieved by install the following a packages
perl-json
perl-yaml
perl-text-csv-xs
orperl-text-csv
Examples for Linux
help
command
./j2tn.pl help
output
./j2tn.pl command [options,...] [arguments,...]
commands:
to-csv in-file-name out-file-name
use - for the out-file-name to go to std-out
debug [debug-bit-flag] command
1 => function calls
2 => current location
4 => parsed json
8 => unparsed json
16 => internal processed data just before output
speak command
echo the command
to-csv
command
./j2tn.pl to-csv <(echo '[{"column1":"data1","column2":[1,2],"column3":3}]') -
output
_normlized_,column3,column1,column2
"{""column2"":[1,2]}",3,data1,"1; 2"
Note
To manipulate the csv
file I suggest xsv