convert-csv-to-json
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "convert-csv-to-json", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Convert CSV to JSON", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# CSVtoJSON | ||
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/iuccio/csvToJson/Node%20CI) | ||
![GitHub branch checks state](https://img.shields.io/github/checks-status/iuccio/csvToJson/master) | ||
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/iuccio/csvToJson/Node%20CI?label=Build)](https://github.com/iuccio/csvToJson/actions?query=workflow%3A%22Node+CI%22) | ||
[![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/iuccio/csvToJson/CodeQL/master?label=CodeQL)](https://github.com/iuccio/csvToJson/actions?query=workflow%3ACodeQL) | ||
[![Code Climate](https://codeclimate.com/github/iuccio/csvToJson/badges/gpa.svg)](https://codeclimate.com/github/iuccio/csvToJson) | ||
@@ -134,12 +134,13 @@ [![NPM Version](https://img.shields.io/npm/v/convert-csv-to-json.svg)](https://npmjs.org/package/convert-csv-to-json) | ||
#### Define field delimiter | ||
As default the filed delimiter is the **semicolon** (**;**). You can define another field delimiter | ||
by call the function ```fieldDelimiter(myDelimiter)```. | ||
If you want that the field delimiter is a **~**: | ||
A field delimiter is needed to split the parsed values. As default the field delimiter is the **semicolon** (**;**), this means that during the parsing when a **semicolon (;)** is matched a new JSON entry is created. | ||
In case your CSV file has defined another field delimiter you have to call the function ```fieldDelimiter(myDelimiter)``` and pass it as parameter the field delimiter. | ||
E.g. if your field delimiter is the comma **,** then: | ||
```js | ||
csvToJson.fieldDelimiter('~').getJsonFromCsv(fileInputName); | ||
csvToJson.fieldDelimiter(',').getJsonFromCsv(fileInputName); | ||
``` | ||
#### Format property value by type | ||
If you want that a number will be printed as a Number type, and values *true* or *false* is printed as a Boolean Type, use: | ||
If you want that a number will be printed as a Number type, and values *true* or *false* is printed as a boolean Type, use: | ||
```js | ||
@@ -146,0 +147,0 @@ csvToJson.formatValueByType().getJsonFromCsv(fileInputName); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82735
20
242