{"id":17348839,"url":"https://github.com/wesscoby/csv-json-convertor","last_synced_at":"2026-01-21T16:01:46.668Z","repository":{"id":35007981,"uuid":"193174334","full_name":"wesscoby/csv-json-convertor","owner":"wesscoby","description":"A simple csv-json convertor","archived":false,"fork":false,"pushed_at":"2023-01-05T10:03:17.000Z","size":1236,"stargazers_count":0,"open_issues_count":10,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-11T08:12:31.671Z","etag":null,"topics":["bash","csv-converter","csv-json-convertor","javascript","json","nodejs","npm","wsl"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wesscoby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-22T00:30:59.000Z","updated_at":"2020-03-15T01:02:02.000Z","dependencies_parsed_at":"2023-01-15T11:54:08.752Z","dependency_job_id":null,"html_url":"https://github.com/wesscoby/csv-json-convertor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/wesscoby/csv-json-convertor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesscoby%2Fcsv-json-convertor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesscoby%2Fcsv-json-convertor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesscoby%2Fcsv-json-convertor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesscoby%2Fcsv-json-convertor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wesscoby","download_url":"https://codeload.github.com/wesscoby/csv-json-convertor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesscoby%2Fcsv-json-convertor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","csv-converter","csv-json-convertor","javascript","json","nodejs","npm","wsl"],"created_at":"2024-10-15T16:53:45.276Z","updated_at":"2026-01-21T16:01:46.650Z","avatar_url":"https://github.com/wesscoby.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Converter banner](./images/banner.png)\r\n\r\n![npm (tag)](https://img.shields.io/npm/v/csv-json-convertor/latest?style=plastic)\r\n![npm](https://img.shields.io/npm/dt/csv-json-convertor?style=plastic)\r\n![GitHub last commit](https://img.shields.io/github/last-commit/wesscoby/csv-json-convertor?style=plastic)\r\n![licence](https://img.shields.io/npm/l/csv-json-convertor.svg?style=plastic)\r\n\r\n\r\n\r\n# Overview\r\nCsv-json-convertor, as its name implies, is a simple *csv-json* conversion tool. You can use it to easily convert csv files to json objects and/or files, as well as the other way around (convert json files to csv).\r\n\r\n# Installation\r\n**Install via npm**: `npm install csv-json-convertor` \u003cbr\u003e\r\n[![NPM](https://img.shields.io/badge/install-npm%20install%20csv--json--convertor-blue)](https://npmjs.org/package/csv-json-convertor)\r\n\r\n\r\n\r\n# Usage\r\nAfter installing, import and use in your project as follows:\r\n### CSV to JSON\r\n```js\r\n// require destructured toJSON function\r\nconst { toJSON } = require('csv-json-convertor');\r\n\r\n// convert csv file\r\ntoJSON('path/to/csvFile.csv', api =\u003e {\r\n    // log or use object (result from the conversion)\r\n    console.log(api.data); \r\n    // save new .json file (./csvFile.json by default) to current directory\r\n    api.save() \r\n});\r\n```\r\n\r\nYou can specify save options such as `filename`, `prettify` and `spaces` as in the following examples \u003cbr\u003e\r\nBy default: \u003cbr\u003e\r\n`filename`: name of the csv file \u003cbr\u003e\r\n`prettify`: false \u003cbr\u003e\r\n`spaces`: 1\r\n```js\r\n// filename\r\ntoJSON('path/to/csvFile.csv', api =\u003e {\r\n    const options = {\r\n        filename: newJsonFile\r\n    };\r\n    api.save(options); \r\n    // Output: newJsonfile.json, not prettified\r\n}); \r\n\r\n// filename, prettify \r\ntoJSON('path/to/csvFile.csv', api =\u003e {\r\n    const options = {\r\n        filename: newJsonFile,\r\n        prettify: true\r\n    };\r\n    api.save(options); \r\n    // Output: newJsonFile.json, prettified using a spacing of 1\r\n}); \r\n\r\n// filename, prettify, spaces\r\ntoJSON('path/to/csvFile.csv', api =\u003e {\r\n    const options = {\r\n        filename: `newJsonFile`,\r\n        prettify: true,\r\n        spaces: 2\r\n    };\r\n    api.save(options); \r\n    // Output: ./newJsonFile.json, prettified using a spacing of 2\r\n}); \r\n```\r\n![Preview of conversion to json](./images/toJsonPreview.png)\r\n\r\n### JSON to CSV\r\nThe `toCSV` method is quite the opposite of `toJSON`\r\n```js\r\n// require destructured toCSV function\r\nconst { toCSV } = require('csv-json-convertor');\r\n\r\n// convert csv file\r\ntoCSV('path/to/jsonFile.json', api =\u003e {\r\n    // log or use string (result from the conversion)\r\n    console.log(api.data);\r\n    // save new .csv file (./jsonFile.csv by default) to current directory \r\n    api.save();\r\n});\r\n```\r\nThe save method accepts an `options` object which currently contains just one property, `filename`, with which you can specify the name of the new file to be saved.\r\n\r\n```js\r\n// filename\r\ntoJSON('path/to/jsonFile.json', api =\u003e {\r\n    const options = {\r\n        filename: `newCsvFile`\r\n    };\r\n    api.save(options); \r\n    // Output: ./newCsvFile.csv\r\n}); \r\n```\r\n# Contributing\r\nI need help with writing a good documentation for this project. Also, any ideas or suggestions on new features, enhancements and performance improvement are very welcome. \u003cbr\u003e\r\nFeel free to contribute in anyway you can. \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesscoby%2Fcsv-json-convertor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesscoby%2Fcsv-json-convertor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesscoby%2Fcsv-json-convertor/lists"}