Socket
Socket
Sign inDemoInstall

convert-json-to-csv

Package Overview
Dependencies
97
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    convert-json-to-csv

An utility to convert json to csv


Version published
Weekly downloads
13
decreased by-45.83%
Maintainers
1
Install size
9.98 MB
Created
Weekly downloads
 

Readme

Source

Convert-Json-To-Csv

This is an open-source utility that lets you convert json data to a flat csv which can be opened directly by any text editors, excel, etc. Note: This utility does not endorse Excel as a default app to open a csv file.

Installation

npm install convert-json-to-csv

Usage

The library offers support for converting two types of json data into csv. The usages for both types, array of arrays and array of objects, is shown below.

###Usage 1- Array of Arrays

var jsonToCsv = require('convert-json-to-csv');
var arrayOfArraysCsv = jsonToCsv.convertArrayOfArrays(inputJson);

#####Sample inputJson: [["Column 1", "Column 2"], ["Row1Column1", "Row1Column2"], ["Row2Column1", "Row2Column2"]]

###Usage 2- Array of Objects

var jsonToCsv = require('convert-json-to-csv');
var arrayOfObjectsCsv = convertArrayOfObjects(inputJson, columnDefinitionArray);

#####Sample inputJson: [{"Column 1" : "Row1Column1", "Column 2" : "Row1Column2"}, {"Column 1" : "Row2Column1", "Column 2" : "Row2Column2"}]

#####Sample ColumnDefinitionArray: ["Column 1", "Column 2"]

Test

The utility can be tested using the following command

npm test

Keywords

FAQs

Last updated on 15 Oct 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc