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

export-json-to-csv

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

export-json-to-csv

The JSON to CSV Converter is a lightweight and efficient npm package designed to seamlessly convert JSON data into CSV format. This tool is particularly useful for developers who need to export or manipulate data in CSV format, a widely accepted standard

0.0.4
Source
npm
Version published
Weekly downloads
39
5.41%
Maintainers
0
Weekly downloads
 
Created
Source

export-json-to-csv

Converts and exports JSON data to CSV

NPM version NODE version types

The JSON to CSV Converter is a lightweight and efficient npm package designed to seamlessly convert JSON data into CSV format. This tool is particularly useful for developers who need to export or manipulate data in CSV format, a widely accepted standard for data interchange.

Demo

Features:

  • Convert JSON objects or arrays to CSV with just a few lines of code.
  • Customizable Output: Customize the headers, keys and other CSV options to fit your specific needs.
  • Large Dataset Handling: Efficiently process and convert large JSON datasets without performance degradation.
  • No Dependencies: The package is lightweight with no external dependencies, ensuring fast performance and easy integration.

Installation

npm install export-json-to-csv

Usage

Below is a simple example of how to use the package:

import { exportCSVFromJSON } from 'export-json-to-csv'
const jsonData = [
    { name: "John Doe", age: 28, city: "New York" },
    { name: "Jane Doe", age: 32, city: "San Francisco" }
];
const options={
    data:jsonData,
    headers:['Name','Age','City'],
    keys:['name','age','city'],
    title:'test file data',
    fileName:'test-export.csv'
}
exportCSVFromJSON(options)

Parameters

ParameterTypeDescriptionRequiredDefault
dataArrayThe JSON data to be converted into CSV format. Each object in the array represents a row.YesN/A
headersArrayCustom headers for the CSV file. If not provided, the keys will be used as headers.NoAll keys in the first object
keysArrayAn array of keys specifying which fields from the JSON data should be included in the CSV.NoAll keys in the first object
titleStringAn optional title to be included at the top of the CSV file.NoN/A
fileNameStringThe name of the generated CSV file.Noexport.csv

Contributing

We welcome contributions! Feel free to submit issues, feature requests, or pull requests to help improve this package.

Keywords

json

FAQs

Package last updated on 14 Aug 2024

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