Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
csv-file-to-json
Advanced tools
Readme
Reads a csv file or data variable having a table and returns an array of obects. In which each object consists of all headers as keys and there data as values.
npm i --save csv-file-to-json
csv-file-to-json
support CommonJS.
Use filePath
key to provide CSV data from file
.
const csvToJson = require("csv-file-to-json");
const dataInJSON = csvToJSON({ filePath: "./filePath.csv" });
Use data
key to provide CSV data from variable or directly
.
const csvToJSON = require("csv-file-to-json");
const dataInJSON = csvToJSON({ data: someCSVData });
FIRST_NAME,LAST_NAME,NUMBER,EMAIL,ADDRESS
Debra,Burks,880012XXXX,debra.burks@yahoo.com,"9273 Thome Ave., `Orchard Park`, NY - 14127"
Kasha,Todd,null,kasha.todd@yahoo.com,"910, Vine Street!!!, (Campbell), CA - 95008"
Tameka,Fisher,8800111XXX,null,"7693 ~ Honey Creek St., Redondo Beach, "CA" 90278"
[
{
FIRST_NAME: 'Debra',
LAST_NAME: 'Burks',
NUMBER: '880012XXXX',
EMAIL: 'debra.burks@yahoo.com',
ADDRESS: '9273 Thome Ave., `Orchard Park`, NY - 14127'
},
{
FIRST_NAME: 'Kasha',
LAST_NAME: 'Todd',
NUMBER: null,
EMAIL: 'kasha.todd@yahoo.com',
ADDRESS: '910, Vine Street!!!, (Campbell), CA - 95008'
},
{
FIRST_NAME: 'Tameka',
LAST_NAME: 'Fisher',
NUMBER: '880111XXXX',
EMAIL: null,
ADDRESS: '7693 ~ Honey Creek St., Redondo Beach, "CA" 90278'
}
]
Use separator
key to specify your separator. Default separator is ","
.
const dataInJSON = csvToJSON({ filePath: "./filePath.txt", separator: "," });
Use hasHeader
key to specify if your file or data contains a header line or not.
Default is true and first line of csv will be considered as header
const dataInJSON = csvToJSON({ filePath: "./filePath.txt", hasHeader: true });
Use headers
key to specify your own headers.
const dataInJSON = csvToJSON({ filePath: "./filePath.txt", hasHeader: false, headers: ["FIRST_NAME", "LAST_NAME", "NUMBER", "EMAIL", "ADDRESS"] });
FAQs
Converts a csv file to a json.
The npm package csv-file-to-json receives a total of 1,377 weekly downloads. As such, csv-file-to-json popularity was classified as popular.
We found that csv-file-to-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.