Converts json file to csv file
npm install jsv-convert!Node.js CI
!npm

---
Converts Javascript object to csv file
npm i jsv-convert
`
---🏆 Contributing
Please read CONTRIBUTING.md for information on how to contribute to the project.
💼 Code of Conduct
We want to facilitate a healthy and constructive community behavior by adopting and enforcing our code of conduct.
Please adhere towards our Code of Conduct.
❤️ Thanks to our awesome contributors.
$3
---
In Nodejs
`
const {prepareTable} = require('../index')const params = [{laguage: 'Javascript',rating: 10},{laguage: 'Dart',rating: 10}]
const data = prepareTable(params) // pass in a array of objects
console.log(data)
`
Usage
This is a utility library for converting JSON data to CSV formatSteps to be followed :-
* Import
FileCoverter class
* Create an object of FileConverter which takes path of the file to be converted as parameter
* invoke generateCsvformat() method
* generateCsvformat() method returns csv data as a string
* generateCsvFile(path: string) takes path of file as argument and writes conveted data to file
`typescript
import {FileConverter} from 'jsv-convert'
import path from 'path'const fc = new FileConverter(path.join(__dirname,'data.json')) // takes path of the file as a parameter
console.log(fc.generateCsvFormat())
fc.generateCsvFile(path)
`
$3
JSON
`json
const data = [
{"language": "javascript", "rating": 5},
{"language": "java", "rating": 5}
]
`
CSV
`json
const data =
`
---
* JSON
`json
const data = [
{"fruit": "Apple","size": "Large","color": "Red"},
{"fruit": "Mango","size": "Small","color": "Yellow"},
{"fruit": "Tangerine","size": "Large","color": "Orange"}
]
`
CSV
`json
const data =
`
---
JSON
`json
const data={
"firstName": "Rack",
"lastName": "Jackon",
"gender": "man",
"age": 24,
"address": {
"streetAddress": "126",
"city": "San Jone",
"state": "CA",
"postalCode": "394221"
},
"phoneNumbers": [
{ "type": "home", "number": "7383627627" }
]
}
`
CSV
`json
const data =
``| language | rating |
| ------------- |:-------------:|
| Javascript | 10 |
| Dart | 10 |