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

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-json-csv

A React component to handle json to csv conversion

2.0.0
latest
Version published
Weekly downloads
3.1K
13.26%
Maintainers
1
Weekly downloads
 
Created

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({ data, fields, filename })}>
  useJsonToCsv
</button>
```html

## License

[MIT License](http://opensource.org/licenses/MIT)

FAQs

Package last updated on 08 Sep 2020

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