easy-json-to-csv-converter
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

Easy-JSON-To-CSV-Converter

Exports a structured JSON array/object to CSV file

Installation

npm i easy-json-to-csv-converter

Usage

import {ConvertJSONtoCSV} from "easy-json-to-csv-converter";

    let jsonArray = [{ name: "memona", lastName: "sultan" }];
    let fileName = "myNameFile";

    // 1 for as it is name; 2 for name with dateTime appended
    let fileNameMode = 1; 

    // true = file will have a header , false = file will not have a header
    let showLabels = true;


    // if you want to change the column names you have to map them 
    let mappedColumns = [
      { key: "name", value: "First Name" },
      { key: "lastName", value: "Last Name" }
    ];


    // this method will download a csv file
   ConvertJSONtoCSV(jsonArray, fileName, fileNameMode, showLabels,mappedColumns );

Readme

Keywords

Package Sidebar

Install

npm i easy-json-to-csv-converter

Weekly Downloads

150

Version

1.0.6

License

ISC

Unpacked Size

3.85 kB

Total Files

4

Last publish

Collaborators

  • memonas