{"id":21665226,"url":"https://github.com/danslapman/json2csv","last_synced_at":"2025-03-20T06:25:35.557Z","repository":{"id":59407261,"uuid":"162845186","full_name":"danslapman/json2csv","owner":"danslapman","description":"Json -\u003e CSV conversion utility","archived":false,"fork":false,"pushed_at":"2024-10-05T16:10:12.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T08:08:07.966Z","etag":null,"topics":["json2csv"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danslapman.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-22T21:55:10.000Z","updated_at":"2024-10-05T16:10:13.000Z","dependencies_parsed_at":"2024-02-04T21:22:06.903Z","dependency_job_id":"f3b030fb-480c-4bf8-b225-9c0f122b3515","html_url":"https://github.com/danslapman/json2csv","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danslapman%2Fjson2csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danslapman%2Fjson2csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danslapman%2Fjson2csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danslapman%2Fjson2csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danslapman","download_url":"https://codeload.github.com/danslapman/json2csv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244562328,"owners_count":20472633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["json2csv"],"created_at":"2024-11-25T10:49:36.207Z","updated_at":"2025-03-20T06:25:35.529Z","avatar_url":"https://github.com/danslapman.png","language":"Haskell","readme":"# json2csv\nJson -\u003e CSV conversion utility\n\njson2csv is able to convert arbitrary newline-delimited JSON (.ndjson) into a valid CSV.\nCurrently, json2csv supports newline-delimited JSON only.\n\n### Build json2csv\n\nYou need to install [Stack](https://docs.haskellstack.org/en/stable/README/#how-to-install)\n\nthen just execute `stack build`\n\n### Usage\n\n`json2csv in.ndjson out.csv +RTS -N`\n\n### Examples\n\n##### nested arrays in single document\n\nJSON input:\n\n```javascript\n{\"a\": [{\"b\": \"b1\", \"c\": [1, 2]},{\"b\": \"b2\", \"c\": [3, 4]}], \"d\": [10, 20]}\n```\n\nCSV output:\n\na.$.b|a.$.c.$|d.$\n-----|-------|---\nb1|1.0|10.0\nb1|1.0|20.0\nb1|2.0|10.0\nb1|2.0|20.0\nb2|3.0|10.0\nb2|3.0|20.0\nb2|4.0|10.0\nb2|4.0|20.0\n\n##### various types of inner values\n\nJSON input:\n\n```javascript\n{\"a\": \"field a0\",\"b\": [{\"value\": \"field b2\"}, {\"value\": \"field b xxx\"}],\"c\": [{\"value\": \"field c0\"}, {\"value\": \"field c xxx\"}]}\n{\"a\": \"field a1\",\"b\": [{\"value\": \"field b1\"}],\"c\": [{\"value\": \"field c1\"}]}\n{\"a\": \"field a2\",\"b\": [{\"value\": \"field b2\"}, {\"value\": \"field b xxx\"}],\"c\": {\"value\": \"field c2\"}, \"d\": 42}\n```\n\nCSV output:\n\na|b.$.value|c.$.value|d|c.value\n-|---------|---------|-|-------\nfield a0|field b2|field c0||\nfield a0|field b2|field c xxx||\nfield a0|field b xxx|field c0||\nfield a0|field b xxx|field c xxx||\nfield a1|field b1|field c1||\nfield a2|field b2||42.0|field c2\nfield a2|field b xxx||42.0|field c2\n\n###### flattening\n\nIf You don't need to know, which values came from arrays, You can use `-f` (`--flatten`)\n\nFor the same JSON input it will give the following output:\n\nc.value|a|d|b.value\n-------|-|-|-------\nfield c0|field a0||field b2\nfield c0|field a0||field b xxx\nfield c xxx|field a0||field b2\nfield c xxx|field a0||field b xxx\nfield c1|field a1||field b1\nfield c2|field a2|42.0|field b2\nfield c2|field a2|42.0|field b xxx\n\n###### intersection\n\nYou can extract only common fields from all lines with `-i` (`--intersect`)\n\nFor the same JSON input it will give the following output:\n\na|b.$.value\n-|---------\nfield a0|field b2\nfield a0|field b xxx\nfield a1|field b1\nfield a2|field b2\nfield a2|field b xxx\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanslapman%2Fjson2csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanslapman%2Fjson2csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanslapman%2Fjson2csv/lists"}