{"id":19509303,"url":"https://github.com/liemle3893/csv2json","last_synced_at":"2026-04-16T22:31:14.680Z","repository":{"id":50450144,"uuid":"207619376","full_name":"liemle3893/csv2json","owner":"liemle3893","description":"Highly configurable CSV to JSON converter","archived":false,"fork":false,"pushed_at":"2023-02-25T13:38:09.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T22:46:23.490Z","etag":null,"topics":["csv-converter","golang","json"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liemle3893.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-10T17:16:04.000Z","updated_at":"2024-08-02T07:22:47.000Z","dependencies_parsed_at":"2024-06-20T21:52:27.155Z","dependency_job_id":"de1878f8-52c4-467f-81e6-4b365b52232a","html_url":"https://github.com/liemle3893/csv2json","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/liemle3893/csv2json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liemle3893%2Fcsv2json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liemle3893%2Fcsv2json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liemle3893%2Fcsv2json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liemle3893%2Fcsv2json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liemle3893","download_url":"https://codeload.github.com/liemle3893/csv2json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liemle3893%2Fcsv2json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31907424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"ssl_error","status_checked_at":"2026-04-16T18:21:47.142Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["csv-converter","golang","json"],"created_at":"2024-11-10T23:11:38.151Z","updated_at":"2026-04-16T22:31:14.625Z","avatar_url":"https://github.com/liemle3893.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSV to JSON converter\n\nThere are times we stuck at import data from CSV to JSON storage (eg: elasticsearch)\n\nProblem is CSV has no correct format. So I decide to write my own tools to convert csv and import as JSON.\n\n### Get it!\n\n```shell\n$ go get github.com/liemle3893/csv2json\n```\n\n### Install it!\n\n```shell\n$ go install github.com/liemle3893/csv2json\n```\n\n### How to use\n\n1. We need a definition about how CSV was organized. Here the sample config `config.hcl`\n\n```hcl\n# Where csv will be organized\nroot = \".\"\n# Where we want ouput our data\nout_directory = \"./out\"\n\n# Relative directory with root path\ndirectory \"user_action\" {\n    # File match this will be included\n    include = [ \".*\" ]\n    # File match this pattern will be excluded\n    exclude = [  ]\n\n    /* \n    Definition of first column in CSV file.\n        Naming will be your friend as the document to share with you co-worker (and your future-self)\n    */\n\tcolumn \"a\" {\n        // Type of data. Current only support Int, Float, Boolean, String. You can easily extends by add more Parser. See `parser` package.\n\t\ttype = \"Int\"\n        // The JSON Path\n\t\tpath = \"a.s.a\"\n\t}\n\tcolumn \"b\" {\n\t\ttype = \"String\"\n\t\tpath = \"a.s.b\"\n        // If this `true`. Skip this column\n\t\tskip = true\n\t}\t\n\tcolumn \"c\" {\n\t\ttype = \"String\"\n\t\tpath = \"a.s.c\"\n\t}\t\t\t\t\n\tcolumn \"d\" {\n\t\ttype = \"String\"\n\t\tpath = \"a.s.ip\"\n        // Default value for this file. This convinient to deal with expanded CSV over time.\n\t\tdefault = \"127.0.0.1\"\n\t}\n\n    // This column will always be added into final JSON.\n\tadditional_column \"type\" {\n\t\ttype = \"String\"\n\t\tpath = \"a.type\"\n\t\tdefault = \"PING\"\n\t}\n}\n\n\ndirectory \"user_info\" {\n    // Include all file but except *.exe\n    include = [ \".*\" ]\n    exclude = [ \"*.exe\" ]\n    // Set file separator to tab\n\tseparator = \"\\t\"\n    column \"exclude\" {\n        type = \"String\"\n        // Record at this index with value 'test' will be skipped\n        excludes = [\"test\"]\n    }\n    column \"Indexed\" {\n        type = \"Indexed\"\n        default = \"undefied\"\n        // Map\n        // web =\u003e Browser\n        // ios, android =\u003e Mobile\n        // other =\u003e Unknown\n        indices = {\"undefied\":\"Unknown\" \"web\"=\"Browser\", \"ios\"=\"Mobile\",\"android\"=\"Mobile\"}\n    } \n}\n```\n\n2. And now we can have our result\n\n```shell\n$ csv2json -c config.hcl\n```\n\nFor more information. Take a look at [samples](https://github.com/liemle3893/csv2json/blob/master/samples) package.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliemle3893%2Fcsv2json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliemle3893%2Fcsv2json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliemle3893%2Fcsv2json/lists"}