🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

react-export-json-csv

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

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.

1.0.1-3.1
latest
Source
npm
Version published
Weekly downloads
300
29.31%
Maintainers
1
Weekly downloads
 
Created
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

react

FAQs

Package last updated on 26 May 2022

Did you know?

Socket

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