Gathering detailed insights and metrics for json-csv
Gathering detailed insights and metrics for json-csv
Gathering detailed insights and metrics for json-csv
Gathering detailed insights and metrics for json-csv
csv-parser
Streaming CSV parser that aims for maximum speed as well as compatibility with the csv-spectrum test suite
json-2-csv
A JSON to CSV and CSV to JSON converter that natively supports sub-documents and auto-generates the CSV heading.
vue-json-excel
Download your JSON as an excel or CSV file directly from the browser
csvtojson
A tool concentrating on converting csv data to JSON with customised parser supporting
Simple CSV export module that can export a rich JSON array of objects to CSV.
npm install json-csv
Typescript
Module System
Min. Node Version
Node Version
NPM Version
80.7
Supply Chain
100
Quality
86.7
Maintenance
100
Vulnerability
100
License
JavaScript (76.62%)
TypeScript (23.38%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
BSD-3-Clause License
16 Stars
188 Commits
17 Forks
2 Watchers
2 Branches
7 Contributors
Updated on Jul 02, 2025
Latest Version
4.0.21
Package Id
json-csv@4.0.21
Unpacked Size
12.16 kB
Size
4.96 kB
File Count
6
NPM Version
6.14.12
Node Version
10.24.1
Published on
Jul 02, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
This is a Node.JS package that can transorm data to CSV. I originally built this back in the 2014 (in the Node v0.10 days). We've come a long way, and it still works! So I won't be deprecating this until it can no longer function in active LTS versions of Node.JS. As LTS versions of Node.JS release, I'll keep this test pipeline up to date.
However, this version of the package (json-csv), 4.x is in maintenance mode and will only receive critical updates and occasionally tooling updates. For more recent improvements like ESM, Typescript support, etc, please refer to @iwsio/json-csv-node for the latest, active version of this package. It shares an identical API with this one and should be pretty seamless to replace.
If you need just a buffered CSV that works in browser apps, checkout the core project @iwsio/json-csv-core. It supports everything except Node Stream API.
The latest version 6 just released in June 2023 and includes better type definitions along with ESM & CommonJS support. Read more about it on the v6 blog post.
1const jsoncsv = require('json-csv') 2 3const csv = await jsoncsv.buffered(data, options) //returns Promise 4 5//optionally, you can use the callback 6jsoncsv.buffered(data, options, (err, csv) => {...}))
When using the streaming API, you can pipe data to it in object mode.
1const jsoncsv = require('json-csv') 2 3const readable = some_readable_source //<readable source in object mode> 4readable 5 .pipe(jsoncsv.stream(options)) //transforms to Utf8 string and emits lines 6 .pipe(something_else_writable) 7})
1{ 2 //field definitions for CSV export 3 fields : 4 [ 5 { 6 //required: field name for source value 7 name: 'string', 8 9 //required: column label for CSV header 10 label: 'string', 11 12 //optional: transform value before exporting 13 transform: function(value) { return value; } 14 } 15 ], 16 17 // Other default options: 18 fieldSeparator: "," 19 ,ignoreHeader: false 20 ,encoding: "utf8" 21}
Here, you can see we're using a deeper set of objects for our source data and we're using dot notation in the field definitions.
1const items = [ 2 { 3 downloaded: false, 4 contact: { 5 company: 'Widgets, LLC', 6 name: 'John Doe', 7 email: 'john@widgets.somewhere', 8 }, 9 registration: { 10 year: 2013, 11 level: 3, 12 }, 13 }, 14 { 15 downloaded: true, 16 contact: { 17 company: 'Sprockets, LLC', 18 name: 'Jane Doe', 19 email: 'jane@sprockets.somewhere', 20 }, 21 registration: { 22 year: 2013, 23 level: 2, 24 }, 25 }, 26] 27const options = { 28 fields: [ 29 { 30 name: 'contact.company', // uses dot notation 31 label: 'Company', 32 }, 33 { 34 name: 'contact.name', 35 label: 'Name', 36 }, 37 { 38 name: 'contact.email', 39 label: 'Email', 40 }, 41 { 42 name: 'downloaded', 43 label: "Downloaded", 44 transform: (v) => v ? 'downloaded' : 'pending', 45 }, 46 { 47 name: 'registration.year', 48 label: 'Year', 49 }, 50 { 51 name: 'registration.level', 52 label: 'Level', 53 transform: (v) => { 54 switch (v) { 55 case 1: return 'Test 1' 56 case 2: return 'Test 2' 57 default: return 'Unknown' 58 } 59 }, 60 }, 61 ], 62} 63 64async function writeCsv() { 65 try { 66 let result = await csv.buffered(items, options) 67 console.log(result) 68 } catch (err) { 69 console.error(err) 70 } 71} 72 73writeCsv()
Company,Name,Email,Downloaded,Year,Level
"Widgets, LLC",John Doe,john@widgets.somewhere,pending,2013,Unknown
"Sprockets, LLC",Jane Doe,jane@sprockets.somewhere,downloaded,2013,Test 2
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9
Reason
2 existing vulnerabilities detected
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More