Prototype for a semi-normalized way to convert a nested JSON document to CSV
Go to file
André Stemmet 8eaa5986b1 Fix spelling errors 2023-06-09 13:13:05 +01:00
test First commit 2023-06-04 17:42:48 +01:00
.gitignore First commit 2023-06-04 17:42:48 +01:00
LICENSE Initial commit 2023-06-02 08:59:57 +00:00
README.md Cosmetic changes ro readme 2023-06-04 18:44:28 +01:00
j2tn.pl Fix spelling errors 2023-06-09 13:13:05 +01:00

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 or perl-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