{"id":42759707,"url":"https://github.com/pengng/json-convert-csv","last_synced_at":"2026-01-29T20:31:33.325Z","repository":{"id":57284740,"uuid":"100167637","full_name":"pengng/json-convert-csv","owner":"pengng","description":"Convert json to csv or csv to jsv","archived":false,"fork":false,"pushed_at":"2017-11-25T07:37:03.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T07:55:27.648Z","etag":null,"topics":["convert","csv","json","stream"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-13T09:51:11.000Z","updated_at":"2017-12-27T02:11:05.000Z","dependencies_parsed_at":"2022-08-25T07:22:37.308Z","dependency_job_id":null,"html_url":"https://github.com/pengng/json-convert-csv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pengng/json-convert-csv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengng%2Fjson-convert-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengng%2Fjson-convert-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengng%2Fjson-convert-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengng%2Fjson-convert-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengng","download_url":"https://codeload.github.com/pengng/json-convert-csv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengng%2Fjson-convert-csv/sbom","scorecard":{"id":727090,"data":{"date":"2025-08-11","repo":{"name":"github.com/pengng/json-convert-csv","commit":"fc7a25af079f999e023b99ac6d903210ed583c85"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/4 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T13:08:42.715Z","repository_id":57284740,"created_at":"2025-08-22T13:08:42.715Z","updated_at":"2025-08-22T13:08:42.715Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28884291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T19:55:09.949Z","status":"ssl_error","status_checked_at":"2026-01-29T19:55:08.490Z","response_time":59,"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":["convert","csv","json","stream"],"created_at":"2026-01-29T20:31:32.746Z","updated_at":"2026-01-29T20:31:33.315Z","avatar_url":"https://github.com/pengng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# json-convert-csv\n\n[![npm](https://img.shields.io/npm/v/json-convert-csv.svg?style=plastic)](https://www.npmjs.com/package/json-convert-csv)\n[![GitHub stars](https://img.shields.io/github/stars/pengng/json-convert-csv.svg?style=plastic\u0026label=Star)](https://github.com/pengng/json-convert-csv/stargazers)\n[![label](https://img.shields.io/github/issues-raw/pengng/json-convert-csv/website.svg?style=plastic)](https://github.com/pengng/json-convert-csv/issues)\n\n##### `json` convert to `csv` or `csv` convert to `json`.\n\n#### `json ` 数据转换为 `csv` 表格。\n\n```javascript\n[\n  {\n    \"name\": \"小白\",\n    \"sex\": \"男\",\n    \"age\": \"18\",\n    \"tel\": \"1383794XXXX\"\n    \"address\": \"广东省 广州市\"\n  },\n  {\n    \"name\": \"小红\",\n    \"sex\": \"女\",\n    \"age\": \"14\",\n    \"tel\": \"1337893XXXX\",\n    \"address\": \"广东省 广州市\"\n  }\n]\n```\n\n| 姓名   |  性别  |  年龄  | 电话          | 地址      |\n| ---- | :--: | :--: | ----------- | ------- |\n| 小白   |  男   |  18  | 1383794XXXX | 广东省 广州市 |\n| 小红   |  女   |  14  | 1337893XXXX | 广东省 广州市 |\n\n### Usage\n\n```bash\nnpm install -S json-convert-csv\n```\n\n- `json` to `csv`\n\n```javascript\nconst fs = require('fs')\nconst CSVStream = require('json-convert-csv').CSVStream\nconst csvSteam = new CSVStream()\n\nconst json = fs.createReadStream('path-to-json-file')\nconst csv = fs.createWriteStream('path-to-csv-file')\n\njson.pipe(csvSteam).pipe(csv)\n```\n\n- `csv` to `json`\n\n```javascript\nconst fs = require('fs')\nconst JSONStream = require('json-convert-csv').JSONStream\nconst jsonStream = new JSONStream()\n\nconst csv = fs.createReadStream('path-to-csv-file')\nconst JSONFile = fs.createWriteStream('new-path-to-json-file')\n\ncsv.pipe(jsonStream).pipe(JSONFile)\n```\n\n### Options\n\n#### new CSVStream([options])\n\n- `options` 配置对象\n  - `header` \\\u003cstring[]\\\u003e 数据的字段名。`['name', 'age', 'tel']`\n  - `headerDisplay` \\\u003cstring[]\\\u003e 数据的显示名称。`['姓名', '年龄', '电话']`\n\n### Event\n\n- [parse](#parse)\n- [convert](#convert)\n- [error](#error)\n\n#### new JSONStream([options])\n\n- `options` 配置对象\n  - `fieldNames` \\\u003cstring[]\\\u003e 字段名数组。\n  - `lineEnding` \\\u003cRegExp\\\u003e 行结束符。默认为`/\\n/` 。也可设置为 `/\\r\\n/`。\n  - `separator` \\\u003cRegExp\\\u003e 分隔符。默认为 `/[,]/`。可设置为 `/\\t/` 或 `/[ ]/` 。\n  - `ignoreFirstLine` \\\u003cboolean\\\u003e 是否忽略首行。默认 `true` 。\n\n### Event\n\n- [line](#line) 当解析每一行时触发。\n\n### parse\n\n##### 参数\n\n| 名称    | 类型     | 描述       |\n| ----- | ------ | -------- |\n| obj   | Object | 解析的每个对象  |\n| index | Number | 第几个解析的对象 |\n\n### convert\n\n##### 参数\n\n| 名称         | 类型     | 描述       |\n| ---------- | ------ | -------- |\n| convertStr | String | 格式化的字符串。 |\n| index      | Number | 第几个解析的对象 |\n\n### error\n\n##### 参数\n\n| 名称    | 类型    | 描述         |\n| ----- | ----- | ---------- |\n| error | Error | 转换过程出现的错误。 |\n\n### line\n\n##### 参数\n\n| 名称   | 类型     | 描述             |\n| ---- | ------ | -------------- |\n| obj  | Object | csv 每一行触析出的对象。 |\n\n### Simple\n\n```javascript\nconst convert = new Csv({\n  header: ['name', 'age', 'tel'],\n  headerDisplay: ['姓名', '年龄', '电话']\n})\n/*\n\u003c\u003c\u003c Input JSON\n[\n  {\n    \"name\": \"小白\",\n    \"age\": \"18\",\n    \"tel\": \"1383794XXXX\"\n  },\n  {\n    \"name\": \"小红\",\n    \"age\": \"14\",\n    \"tel\": \"1337893XXXX\"\n  }\n]\n\u003e\u003e\u003e Output CSV\n*/\n```\n\n| 姓名   | 年龄   | 电话          |\n| ---- | ---- | ----------- |\n| 小白   | 18   | 1383794XXXX |\n| 小红   | 14   | 1337893XXXX |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengng%2Fjson-convert-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengng%2Fjson-convert-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengng%2Fjson-convert-csv/lists"}