@@ -29,7 +29,7 @@ $ npm install @mrodrig/json-2-csv-cli
29
29
30
30
## Upgrading?
31
31
32
- Upgrading to v4 from v3 ? Check out the [ upgrade guide] ( https://github.com/mrodrig/json-2-csv/blob/master/upgrade_guides/UPGRADE_3_to_4 .md ) .
32
+ Upgrading to v5 from v4 ? Check out the [ upgrade guide] ( https://github.com/mrodrig/json-2-csv/blob/master/upgrade_guides/UPGRADE_4_to_5 .md ) .
33
33
34
34
## Usage
35
35
41
41
``` javascript
42
42
import { json2csv } from ' json-2-csv' ;
43
43
```
44
- Looking for examples? Check out the Wiki: [ json-2-csv Wiki] ( https://github.com/mrodrig/json-2-csv/wiki )
45
44
46
45
### API
47
46
48
- #### ` json2csv(array, options) ` => ` Promise< string> `
47
+ #### ` json2csv(array, options) ` => ` string `
49
48
50
- Returns a ` Promise ` that resolves with the CSV ` string ` or rejects with an ` Error ` if there was an issue.
49
+ Returns the CSV ` string ` or rejects with an ` Error ` if there was an issue.
51
50
52
51
* ` array ` - An array of JSON documents to be converted to CSV.
53
52
* ` options ` - (Optional) A JSON document specifying any of the following key value pairs:
@@ -165,11 +164,9 @@ Returns a `Promise` that resolves with the CSV `string` or rejects with an `Erro
165
164
* Default: `false`
166
165
167
166
168
- For examples, please refer to the [json2csv API Documentation (Link)](https://github.com/mrodrig/json-2-csv/wiki/json2csv-Documentation)
167
+ #### `csv2json(csv, options)` => object[]
169
168
170
- #### `csv2json(csv, options)` => Promise<object[]>
171
-
172
- Returns a `Promise` that resolves with the JSON object array (`object[]`) or rejects with an `Error` if there was an issue.
169
+ Returns the JSON object array (`object[]`) or rejects with an `Error` if there was an issue.
173
170
174
171
* `csv` - A string of CSV
175
172
* `options` - (Optional) A JSON document specifying any of the following key value pairs:
@@ -197,8 +194,6 @@ Returns a `Promise` that resolves with the JSON object array (`object[]`) or rej
197
194
* `trimFieldValues` - Boolean - Should the field values be trimmed?
198
195
* Default: `false`
199
196
200
- For examples, please refer to the [csv2json API Documentation (Link)](https://github.com/mrodrig/json-2-csv/wiki/csv2json-Documentation)
201
-
202
197
### CLI
203
198
Note: As of `3.5.8`, the command line interface functionality has been pulled out to a separate package. Please be sure to
204
199
install the `@mrodrig/json-2-csv-cli` NPM package if you wish to use the CLI functionality shown below:
@@ -258,9 +253,6 @@ To see test coverage, please run:
258
253
$ npm run coverage
259
254
```
260
255
261
- ## Frequently Asked Questions (FAQ)
262
- Please find the updated list (relocated to the Wiki) here: [ Frequently Asked Questions (Link)] ( https://github.com/mrodrig/json-2-csv/wiki/FAQ )
263
-
264
256
## Features
265
257
* Header Generation (per document keys)
266
258
* Allows for conversion of specific keys in both json2csv and csv2json via the options.keys parameter (as of 1.1.2)
@@ -272,11 +264,11 @@ Please find the updated list (relocated to the Wiki) here: [Frequently Asked Que
272
264
* Allows for custom field delimiters, end of line delimiters, etc.
273
265
* Wrapped value support for json2csv and csv2json (as of 1.3.0)
274
266
* Support for multiple different schemas (as of 1.4.0)
275
- * Promisified versions of the functions are now available by default: json2csvAsync, csv2jsonAsync (as of 2.2.0)
276
267
* RFC 4180 Compliance (as of 3.0.0)
277
268
* CLI functionality (as of 3.0.0)
278
269
* `csv2json test.csv -o output.json`
279
270
* *and*
280
271
* `json2csv test.json -o output.csv -W -k arrayOfStrings -o output.csv`
281
272
* Empty field value option (as of 3.1.0)
282
273
* TypeScript typings included (as of 3.4.0) - thanks to [ @GabrielCastro ] ( https://github.com/GabrielCastro ) !
274
+ * Synchronous use case support (as of 5.0.0) - thanks to [ @Nokel81 ] ( https://github.com/Nokel81 )
0 commit comments