Socket
Socket
Sign inDemoInstall

react-export-json-csv

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-export-json-csv

A react component to easily Export csv of your json data and rearrange your headers column based on your UI tables order.


Version published
Weekly downloads
381
increased by7.93%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

⌗ react-export-json-csv

npm npm npm

A react component to easily Export csv of your json data and rearrange your headers column based on your UI tables order.

Live Demo

Coming Soon

Features

  • Create a csv download from json data
  • rearrange Headers
  • Lightweight
  • Easy to use
  • optional filename

Install

Install with npm:

npm i react-export-json-csv

Example Usage

import { ExportJsonCsv } from 'react-export-json-csv';
...
const headers = [
  {
    key: 'id',
    name: 'ID',
  },
  {
    key: 'fname',
    name: 'First Name',
  },
]

const data = [
  {
    id: '1',
    fname: 'John',
  },
  {
    id: '2',
    fname: 'Doe',
  },
]

...
<ExportJsonCsv headers={headers} items={data}>Export</ExportJsonCsv>

Props

PropTypeRequirementDefaultDescription
headersarrayrequirednullarray of objects
itemsarrayrequirednullarray of objects
fileTitlestringoptional"exported.csv"The complete filename
styleobjectoptionalnulluse react inline style
classNamestringoptionalnulluse your existing class for button

Contributing

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

Source

Source[1] https://medium.com/@danny.pule/export-json-to-csv-file-using-javascript-a0b7bc5b00d2 Source[2] https://stackoverflow.com/questions/30993149/how-to-rearrange-csv-json-keys-columns-javascript

Note

Arrange your header array to rearrage csv/json keys columns to your expected result. headers array key must be the same wtih your items Object Keys in column.

Keywords

FAQs

Last updated on 26 May 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