json2csv
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@streamparser/json | 0.0.6 | 41.17 kB | MIT | prod | |
commander | 6.2.1 | 29.89 kB | MIT | prod | |
lodash.get | 4.4.2 | 7.37 kB | MIT | prod |
json2csv is a powerful JavaScript utility that enables the conversion of JSON data into CSV format. This tool is beneficial for handling and manipulating data, especially in scenarios where CSV files are preferred or specifically required. It should be noted that this package has been abandoned and the code has moved to a new GitHub home: https://github.com/juanjoDiaz/json2csv.
Using json2csv in your JavaScript projects involves installing and importing required modules from npm libraries. From version 6 onwards, json2csv is broken into smaller libraries including Plainjs, Node, WHATWG, CLI, Transforms, and Formatters, all of which are published to NPM independently. Here's a basic example of how to use the Parser API from the PlainJs library:
const { Parser } = require('@json2csv/plainjs');
const data = [
{
fieldA: 'valueA',
fieldB: 'valueB'
},
{
fieldA: 'valueA1',
fieldB: 'valueB1'
}
];
const json2csv = new Parser();
const csv = json2csv.parse(data);
console.log(csv);
In this example, we're creating a new Parser
instance from the @json2csv/plainjs
package, and using it to convert an array of objects (JSON format) into CSV format.
Documentation for json2csv can be found on the following website: https://juanjodiaz.github.io/json2csv. This documentation provides detailed information and guidelines for effectively using json2csv, including API documentation, installation instructions, and code examples.