{"id":25220699,"url":"https://github.com/rockwelln/csv2json","last_synced_at":"2026-05-18T03:10:00.357Z","repository":{"id":57447440,"uuid":"213952127","full_name":"rockwelln/csv2json","owner":"rockwelln","description":null,"archived":false,"fork":false,"pushed_at":"2019-11-08T08:29:05.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-08T00:16:22.906Z","etag":null,"topics":["csv","dicts","json","json-string"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/rockwelln.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":"2019-10-09T15:16:32.000Z","updated_at":"2019-11-08T08:25:20.000Z","dependencies_parsed_at":"2022-09-10T08:00:26.269Z","dependency_job_id":null,"html_url":"https://github.com/rockwelln/csv2json","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rockwelln/csv2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockwelln%2Fcsv2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockwelln%2Fcsv2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockwelln%2Fcsv2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockwelln%2Fcsv2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rockwelln","download_url":"https://codeload.github.com/rockwelln/csv2json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rockwelln%2Fcsv2json/sbom","scorecard":{"id":781987,"data":{"date":"2025-08-11","repo":{"name":"github.com/rockwelln/csv2json","commit":"b6e2e624aa22e2eea30562e12af399e54b7631f4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pythonpackage.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Code-Review","score":0,"reason":"Found 0/14 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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpackage.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/rockwelln/csv2json/pythonpackage.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pythonpackage.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/rockwelln/csv2json/pythonpackage.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:26","Warn: pipCommand not pinned by hash: .github/workflows/pythonpackage.yml:33","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"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":"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":"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":"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":"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T05:07:09.025Z","repository_id":57447440,"created_at":"2025-08-23T05:07:09.026Z","updated_at":"2025-08-23T05:07:09.026Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["csv","dicts","json","json-string"],"created_at":"2025-02-10T21:55:08.818Z","updated_at":"2026-05-18T03:10:00.340Z","avatar_url":"https://github.com/rockwelln.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version](https://badge.fury.io/py/nx-csv2json.svg)](https://badge.fury.io/py/nx-csv2json)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# CSV 2 JSON\n\nLibrary to convert an CSV into python dict.\nThe CSV headers are used as path to location in the target dict.\n\n## Path expression\n\nThe path is separated with dots (.) to express list indexes and dict keys.\nIf all the sub keys of a collections are made of digits, the collections is assumed to be a list.\nOtherwise it's a dict.\n\nNote: List indices don't have to be contiguous or ordered.\n\nSample:\n\n``` csv\n\"a.0,a.5,a.3\"\n```\n\nwill translate into:\n\n``` json\n{\n    \"a\": [None, None, None, None, None]\n}\n```\n\nBut,\n\n``` csv\n\"a.0,a.5,a.3,a.b\"\n```\n\nwill translate into:\n\n``` json\n{\n    \"a\": {\n        \"0\": None,\n        \"5\": None,\n        \"3\": None,\n        \"b\": None,\n    }\n}\n```\n\nNote: list may contain sub-lists and sub-dicts at any level\n\n## Options\n\nBy default the input type is preserved. (meaning there is no type conversion by default)\nSeveral options, may be used to alter the output:\n\n### fill_value\n\nIndicate which value can be used to populate empty indices in the list.\n\nSample:\n\n``` python\noptions = {\n    \"abc\": {\"fill_value\": \"?\"}\n}\nheaders = \"abc.3,abc.1\"\n```\n\nwill produce the minimal output:\n\n```json\n{\n    \"abc\": [\"?\", \"?\", \"?\", \"?\"]\n}\n```\n\n### infer_type\n\nIndicates the transcoder to try to figure out the type of the data and to cast it.\n\nSample:\n\n``` python\noptions = {\n    \"abc\": {\"infer_type\": True},\n    \"ghi\": {\"infer_type\": True},\n}\nheaders = \"abc,def,ghi\"\ndata = [\"1\", \"2\", \"g,h,i\"]\n```\n\nwill produce the output:\n\n```json\n{\n    \"abc\": 1,\n    \"def\": \"2\",\n    \"ghi\": [\"g\", \"h\", \"i\"]\n}\n```\n\n#### Supported types:\n\n* int\n* bool\n* array\n\n### render\n\nA callable which return the output used instead of the original input value.\n\nSample:\n\n``` python\noptions = {\n    \"abc\": {\"render\": lambda _, _: \"?\"}\n}\nheaders = \"abc,def\"\ndata = [\"1\", \"2\"]\n```\n\nwill produce the output:\n\n```json\n{\n    \"abc\": \"?\",\n    \"def\": \"2\"\n}\n```\n\n### optional\n\nRefer a callable to figure out if the entry should be removed from the output or not.\n\nSample:\n\n``` python\noptions = {\n    \"abc\": {\"optional\": len}\n}\nheaders = \"abc,def\"\ndata = [\"\", \"\"]\n```\n\nwill produce the output:\n\n```json\n{\n    \"def\": \"\"\n}\n```\n\n#### multi-level\n\nThis may affect the output structure on several levels.\n\nSample:\n``` python\nheaders = \"abc.0,foo.0,foo.1\".split(\",\")\noptions = {\n    \"abc.0\": {\"optional\": len},\n    \"foo\": {\"optional\": len},\n    \"foo.0\": {\"optional\": len},\n    \"foo.1\": {\"optional\": len},\n}\nassert headers2template(headers, options=options).render_as_dict([\"\", \"\", \"\"]) == {\n    \"abc\": []\n}\n# \"foo\" does not appear in the output because of 3 factors:\n# - all its sub-items are optional\n# - all its sub-items are dropped\n# - it is also optional\n```\n\n## JSON to headers\n\nThe function `json2csv_headers` may be used to evaluate what *could* be the headers of a CSV input based on a JSON.\nThis function only get a JSON string and returns a list of headers and a list of values extracted from the JSON string.\n\nSample\n\n``` python\njson2csv_headers('{\"a\": \"true\",\"b\": null}') == ([\"a\", \"b\"], [\"true\", None])\n```\n\n## CLI\n\n### csv2json\n\nThe package provide an handy CLI command to turn CSV inputs to JSON outputs, just type `csv2json -h`\n\n### json2csv\n\nUse the flag '-r' for the command `csv2json` to extrapolate from a JSON, what the headers might be.\n\nSample\n\n``` bash\necho '{\"a\": 1, \"b\": [\"toto\", {\"test\": \"bar\"}, 1, 3]}' | csv2json -r -\nheaders: a,b.0,b.1.test,b.2,b.3\nvalues: 1,toto,bar,1,3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockwelln%2Fcsv2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frockwelln%2Fcsv2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frockwelln%2Fcsv2json/lists"}