Javarome / csv4json

Converts CSV to JSON, and vice versa.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

csv4json

Converts CSV to JSON, and vice versa.

Vanilla JS, no dependencies.

Setup

Either install it globally:

npm install -g @javarome/csv4json

or locally:

npm install @javarome/csv4json

Usage

CLI

csv4json --input <csv or json file> --output <json or csv file>

API

Convert file

const converter = new Csv4Json('../test/input.csv', '../test/output.json', ',', '\n')
converter.run().then(result => {
  console.log('Written', result)
})

Convert contents

const converter = new Csv4Json('../test/input.csv', '../test/output.json', ',', '\n')
converter.run().then(result => {
  console.log('Written', result)
})

About

Converts CSV to JSON, and vice versa.


Languages

Language:JavaScript 100.0%