
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
json-to-csv-export
Advanced tools
A function to easily generate csv downloads of your json data. ✨
https://json-to-csv-export.coston.io
Install with npm:
npm i json-to-csv-export
// import jsonToCsvExport from "json-to-csv-export";
() => {
const mockData = [
{
ID: 1,
"First Name": "Sarajane",
"Last Name": "Wheatman",
Email: "swheatman0@google.nl",
Language: "Zulu",
"IP Address": "40.98.252.240",
},
{
ID: 2,
"First Name": "Linell",
"Last Name": "Humpherston",
Email: "lhumpherston1@google.com.br",
Language: "Czech",
"IP Address": "82.225.151.150",
},
];
return (
<button onClick={() => jsonToCsvExport({ data: mockData })}>
Download Data
</button>
);
};
// import jsonToCsvExport from "json-to-csv-export";
() => {
const mockData = [
{
id: 1,
firstName: "Sarajane",
lastName: "Wheatman",
email: "swheatman0@google.nl",
language: "Zulu",
ip: "40.98.252.240",
},
{
id: 2,
firstName: "Linell",
lastName: "Humpherston",
email: "lhumpherston1@google.com.br",
language: "Czech",
ip: "82.225.151.150",
},
];
const headers = [
{ key: "id", label: "Identifier" },
{ key: "firstName", label: "First Name" },
{ key: "lastName", label: "Last Name" },
{ key: "email", label: "Email Address" },
{ key: "language", label: "Language" },
{ key: "ip", label: "IP Address" },
];
return (
<button onClick={() => jsonToCsvExport({ data: mockData, headers })}>
Download Data
</button>
);
};
interface HeaderMapping {
label: string;
key: string;
}
# | Property | Type | Requirement | Default | Description |
---|---|---|---|---|---|
1 | data | Record<string, any>[] | required | array of objects | |
2 | filename | string | optional | "export.csv" | The filename. The .csv extention will be added if not included in file name |
3 | delimiter | string | optional | "," | fields separator |
4 | headers | string[] , HeaderMapping[] | optional | provided data object keys |
Please help provide good data faster! Submit any issues and/or make a pull request!
FAQs
Easily generate csv downloads of your json data.
The npm package json-to-csv-export receives a total of 34,044 weekly downloads. As such, json-to-csv-export popularity was classified as popular.
We found that json-to-csv-export demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.