🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

zll-json2csv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zll-json2csv - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+1
-1
package.json
{
"name": "zll-json2csv",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convert your js/json object/string into csv string",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,2 +5,3 @@ # json2csv.js

![GitHub file size in bytes](https://img.shields.io/github/size/ZhengLinLei/json2csv/src/json2csv.js)
![npm](https://img.shields.io/npm/dw/zll-json2csv)

@@ -11,2 +12,43 @@ ## Installation

npm install zll-json2csv
```
npm i zll-json2csv
```
## Usage
```javascript
const json2csv = require('zll-json2csv');
// Create a JSON array
const json = [
{
name: "John",
age: 30,
city: "New York"
},
{
name: "Peter",
age: 40,
city: "Los Angeles"
},
{
name: "Amy",
age: 50,
city: "Chicago"
}
];
// Convert JSON array to CSV string
const csv = json2csv(json);
// Print CSV string
console.log(csv);
```
## Output
```csv
name,age,city
John,30,New York
Peter,40,Los Angeles
Amy,50,Chicago
```