1- # Convert JSON to CSV or CSV to JSON
1+ # json-2-csv
2+ ** Convert JSON to CSV _ or_ CSV to JSON**
23
3- [ ![ Build Status] ( https://travis-ci.org/mrodrig/json-2-csv.svg?branch=master )] ( https://travis-ci.org/mrodrig/json-2-csv )
44[ ![ Dependencies] ( https://img.shields.io/david/mrodrig/json-2-csv.svg?style=flat-square )] ( https://www.npmjs.org/package/json-2-csv )
5+ [ ![ Build Status] ( https://travis-ci.org/mrodrig/json-2-csv.svg?branch=master )] ( https://travis-ci.org/mrodrig/json-2-csv )
56[ ![ Downloads] ( http://img.shields.io/npm/dm/json-2-csv.svg )] ( https://www.npmjs.org/package/json-2-csv )
67[ ![ NPM version] ( https://img.shields.io/npm/v/json-2-csv.svg )] ( https://www.npmjs.org/package/json-2-csv )
78[ ![ Known Vulnerabilities] ( https://snyk.io/test/npm/json-2-csv/badge.svg )] ( https://snyk.io/test/npm/json-2-csv )
@@ -21,12 +22,12 @@ $ npm install json-2-csv
2122## Usage
2223
2324``` javascript
24- var converter = require (' json-2-csv' );
25+ let converter = require (' json-2-csv' );
2526```
2627
2728### API
2829
29- #### json2csv(array, callback, options)
30+ #### ` converter. json2csv(array, callback, options)`
3031
3132* ` array ` - An array of JSON documents to be converted to CSV.
3233* ` callback ` - A function of the form ` function (err, csv) ` ;
@@ -58,14 +59,16 @@ var converter = require('json-2-csv');
5859 * Default: ` null `
5960 * If you have a nested object (ie. {info : {name: 'Mike'}}), then set this to [ 'info.name']
6061 * If you want all keys to be converted, then specify ``` null ``` or don't specify the option to utilize the default.
62+
63+
6164
6265For examples, please refer to the [ json2csv API Documentation (Link)] ( https://github.com/mrodrig/json-2-csv/wiki/json2csv-Documentation )
6366
64- #### Promisified Version: json2csvPromisified(array, options).then(...).catch(...);
67+ #### Promisified Version: ` converter. json2csvPromisified(array, options)`
6568
6669Available in version ` 2.2.0 ` , this functionality makes use of promises from the ` bluebird ` module.
6770
68- #### csv2json(csv, callback, options)
71+ #### ` converter. csv2json(csv, callback, options)`
6972
7073* ` csv ` - A string of CSV
7174* ` callback ` - A function of the form ` function (err, array) ` ; This function will receive any errors and/or the array of JSON documents generated.
@@ -90,7 +93,7 @@ Available in version `2.2.0`, this functionality makes use of promises from the
9093
9194For examples, please refer to the [ csv2json API Documentation (Link)] ( https://github.com/mrodrig/json-2-csv/wiki/csv2json-Documentation )
9295
93- #### Promisified Version: csv2jsonPromisified(csv, options).then(...).catch(...);
96+ #### Promisified Version: ` csv2jsonPromisified(csv, options) `
9497
9598Available in version ` 2.2.0 ` , this functionality makes use of promises from the ` bluebird ` module.
9699
@@ -109,10 +112,10 @@ $ npm run coverage
109112
110113Current Coverage is:
111114```
112- Statements : 94.91 % ( 205/216 )
113- Branches : 93.33 % ( 154/165 )
114- Functions : 100% ( 37/37 )
115- Lines : 95.59 % ( 195/204 )
115+ Statements : 94.69 % ( 196/207 )
116+ Branches : 93.55 % ( 145/155 )
117+ Functions : 100% ( 34/34 )
118+ Lines : 95.38 % ( 186/195 )
116119```
117120
118121## Frequently Asked Questions (FAQ)
0 commit comments