JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 40617
  • Score
    100M100P100Q159898F
  • License MIT

Easily generate csv downloads of your json data.

Package Exports

  • json-to-csv-export
  • json-to-csv-export/lib/cjs/index.js
  • json-to-csv-export/lib/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (json-to-csv-export) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

⌗ 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 jsonToCsvExport 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={() => jsonToCsvExport(dataToConvert)}>
Download Data
</button>

Properties

# Property Type Requirement Default Description
1 data [] 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[] optional provided data object keys List 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!