# 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` or `perl-text-csv` ## Examples for Linux ### help #### command ```bash ./j2tn.pl help ``` #### output ```text ./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 ```bash ./j2tn.pl to-csv <(echo '[{"column1":"data1","column2":[1,2],"column3":3}]') - ``` #### output ```csv _normlized_,column3,column1,column2 "{""column2"":[1,2]}",3,data1,"1; 2" ``` ## Note To manipulate the `csv` file I suggest `xsv` - [xsv Source](https://github.com/BurntSushi/xsv) - [xsv Binary Release](https://github.com/BurntSushi/xsv/releases)