1
- # Convert JSON to CSV or CSV to JSON
1
+ # json-2-csv
2
+ ** Convert JSON to CSV _ or_ CSV to JSON**
2
3
3
- [ ![ Build Status] ( https://travis-ci.org/mrodrig/json-2-csv.svg?branch=master )] ( https://travis-ci.org/mrodrig/json-2-csv )
4
4
[ ![ 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 )
5
6
[ ![ Downloads] ( http://img.shields.io/npm/dm/json-2-csv.svg )] ( https://www.npmjs.org/package/json-2-csv )
6
7
[ ![ NPM version] ( https://img.shields.io/npm/v/json-2-csv.svg )] ( https://www.npmjs.org/package/json-2-csv )
7
8
[ ![ 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
21
22
## Usage
22
23
23
24
``` javascript
24
- var converter = require (' json-2-csv' );
25
+ let converter = require (' json-2-csv' );
25
26
```
26
27
27
28
### API
28
29
29
- #### json2csv(array, callback, options)
30
+ #### ` converter. json2csv(array, callback, options)`
30
31
31
32
* ` array ` - An array of JSON documents to be converted to CSV.
32
33
* ` callback ` - A function of the form ` function (err, csv) ` ;
@@ -58,6 +59,8 @@ var converter = require('json-2-csv');
58
59
* Default: ` null `
59
60
* If you have a nested object (ie. {info : {name: 'Mike'}}), then set this to [ 'info.name']
60
61
* If you want all keys to be converted, then specify ``` null ``` or don't specify the option to utilize the default.
62
+
63
+
61
64
62
65
For examples, please refer to the [ json2csv API Documentation (Link)] ( https://github.com/mrodrig/json-2-csv/wiki/json2csv-Documentation )
63
66
@@ -109,10 +112,10 @@ $ npm run coverage
109
112
110
113
Current Coverage is:
111
114
```
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 )
116
119
```
117
120
118
121
## Frequently Asked Questions (FAQ)
0 commit comments