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-to-custom-json
Advanced tools
Readme
Looking for Python version ? Check here : https://github.com/Its-Just-Nans/csv-to-custom-json-python
Transform your .csv
file to a custom JSON structure :) ! In browser and NodeJS !
You just want to parse your .csv
without structure :
const parseFile = require("csv-to-custom-json");
const parsed = await parseFile(linkFile);
First you need to create the schema of your futur JSON
const schema = {
num1: "int",
num2: "float",
num3: "string",
num4 (value, allValues) {
// this is a callBack !
},
async num5 (value, allValues) {
// this is a async callBack !
}
};
// then
const parsedFile = await parseFile("myfile.csv", schema);
Legend :
num1
,num2
,num3
,num4
,num5
are rows from the.csv
- You can see that the value of attribute define how variable will be parse
- You can see that we can use callBack, the value returned by the callBack will be put in the result (if not
undefined
ornull
)
This program allow you to create complex structured JSON, like this :
const schema = {
hello: [
{
num4: "int",
num1: "string"
}
],
hello2: [
{
num4: "int",
num1: [
{
num3: "string"
}
]
}
]
};
// then
const parsedFile = await parseFile("myfile.csv", schema);
To use options, you need to add a third parameters which is an object with options.
Example :
const parsedFile = await parseFile("myfile.csv", schema, {
debug: true,
});
All options are listed in the documentation (you can run examples to help you) !
A whole documentation is available on ./docs
To see examples, you can do :
npm run test
And see *.test.js
files to know which code is used !
Oh no 😟 !
Go here csv-to-custom-json/issues
I coded this instead of doing my homework 😳
You can discuss here : csv-to-custom-json/discussions
Licensed under the MIT License - LICENSE
FAQs
Easily transform your CSV to a custom JSON with cool options
The npm package csv-to-custom-json receives a total of 4 weekly downloads. As such, csv-to-custom-json popularity was classified as not popular.
We found that csv-to-custom-json demonstrated a healthy version release cadence and project activity because the last version was released less than 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.