You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,13 +41,12 @@ or
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)
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)
Thanks to [@Nokel81](https://github.com/Nokel81) for the pull request to convert the module to convert the asynchronous internal flow to be entirely synchronous. This helps enable certain use cases where a conversion is needed in a synchronous manner, or where asynchronous code might not be feasible. While these changes shift the module towards a more synchronous focused use case, it's still entirely possible to perform JSON to CSV or CSV to JSON conversions for an asynchronous use case too.
8
+
9
+
```javascript
10
+
constconverter=require('json-2-csv');
11
+
12
+
// Synchronous:
13
+
14
+
constcsv=converter.json2csv([ { level:'info', message:'Our first test' }]);
0 commit comments