react-json-csv

2.0.0 • Public • Published

React Json Csv

A React library to render a component that helps in json to csv conversion.

npm version dependencies Status badge devDependency Status badge Downloads Paypal

Install

Install the component using NPM:

$ npm install --save react-json-csv

Usage

Initialise module

import {
  JsonToCsv,
  useJsonToCsv
} from 'react-json-csv';

Render

Json To Csv

Converts json to csv file (.csv format) and downloads it

const filename = 'Csv-file',
  fields = {
    "index": "Index",
    "guid": "GUID"
  },
  style = {
    padding: "5px"
  },
  data = [
    { index: 0, guid: 'asdf231234'},
    { index: 1, guid: 'wetr2343af'}
  ],
  text = "Convert Json to Csv";
<JsonToCsv
  data={data}
  filename={filename}
  fields={fields}
  style={style}
  text={text}
/>

use Json To Csv

const { saveAsCsv } = useJsonToCsv();
<button onClick={saveAsCsv({ datafieldsfilename })}>
  useJsonToCsv
</button>
```html
 
## License
 
[MIT License](http://opensource.org/licenses/MIT)

Readme

Keywords

Package Sidebar

Install

npm i react-json-csv

Weekly Downloads

1,804

Version

2.0.0

License

MIT

Unpacked Size

71.4 kB

Total Files

18

Last publish

Collaborators

  • praveenkumar-outlook