Socket
Socket
Sign inDemoInstall

json-to-csv-export

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-to-csv-export

Easily generate csv downloads of your json data.


Version published
Weekly downloads
26K
increased by7.27%
Maintainers
1
Install size
10.5 kB
Created
Weekly downloads
 

Readme

Source

⌗ json-to-csv-export

A function to easily generate csv downloads of your json data. ✨

npm package version   npm downloads   code style: prettier

Live Demo

https://json-to-csv-export.coston.io

Features

  • Create a csv download from json data
  • Lightweight
  • Easy to use
  • Optional filename
  • Optional header names

Install

Install with npm:

npm i json-to-csv-export

Or load from a CDN:

<script src="https://cdn.jsdelivr.net/npm/json-to-csv-export"></script>

Example Usage

import csvDownload from 'json-to-csv-export'

const ipAddressesData = [
  {
    id: "1",
    name: "Sarajane Wheatman",
    ip: "40.98.252.240"
  },
  {
    id: "2",
    name: "Linell Humpherston",
    ip: "82.225.151.150"
  }
]

const dataToConvert = {
  data: ipAddressesData,
  filename: 'ip_addresses_report',
  delimiter: ',',
  headers: ['IP', "Full Name", "IP Address"]
}

...

<button onClick={() => csvDownload(dataToConvert)}>
Download Data
</button>

Properties

#PropertyTypeRequirementDefaultDescription
1data[]requiredarray of objects
2filenamestringoptional"export.csv"The filename. The .csv extention will be edded if not included in file name
3delimiterstringoptional";"fields separator
4headersstring[]optionalprovided data object keysList of columns that will be used in the final CSV file.

Migration from version 1.x to 2.x

migration.md

Contributing

Please help provide good data faster! Submit any issues and/or make a pull request!

Keywords

FAQs

Last updated on 05 Dec 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc