1.3.2 • Published 7 years ago

json2csv-cli v1.3.2

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

jsonTocsv (j2c)

CLI that transform a JSON to CSV with Key,Value format. Usefull to list all keys from a json object.

A web app also available --> Web App jsonToCsv

Installation

Install CLI :

npm install json2csv-cli -g

Install Api

npm install --save json2csv-cli

Usage CLI

j2c --json [file.json] --csv [file.csv]
Options:

    -V, --version       output the version number
    --json [file.json]  Your entry file, must be a json file.
    --csv [file.csv]    The csv file that will be saved. (If not existing , will create it)
    -f, --first         Specify the name of the object at the first position (default = obj)
    -h, --help          output usage information

Usage Api

The Api is available for Browser and nodejs.

import J2C from "json2csv-cli";

or

const J2C = require("json2csv-cli");
const parsedJson = JSON.parse(jsonUnParsed); // transform the JSON in JS object
const jsonTocsv = new J2C(parsedJson); // Instanciate
jsonTocsv.convert(); // Use convert() method to transform the JS object in csv format.
const csv = jsonTocsv.onceFilled(); // Once the array is filled , use this method to apply correct format.

Output

file.csv :

Key,Values
obj.test.path,value1
obj.other.path.test,value2
obj.again.path,value3

License

MIT

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago