1.0.5 • Published 3 years ago

converter-json-csv v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Function to export JSON data to csv file

How to use?

npm install converter-json-csv

import package into your project

Function call

To use the function is very simple:

downloadCSVFromJson(`yourfile.csv`, jsonCSV);

The function receives two parameters, the first one receives the name of the file, the second one will receive the data in JSON

Using with React.js

import React, { useEffect } from 'react';
import downloadCSVFromJson from 'converter-json-csv';
const fruits = [
    {'apple': 50, 'watermelon': 120, 'pear': 250},
    {'apple': 150, 'watermelon': 240, 'pear': 10},
    {'apple': 170, 'watermelon': 182, 'pear': 19},
]
export default function App(){

    useEffect(() => {
        downloadCSVFromJson('yourFile.csv', fruits);       
    },[]);

...

github: https://github.com/Ricardo-script/package-converter-json-csv

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago