convert csv to json using header column as json key
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
main.go
sample.json
sample.tsv

README.md

csv2json

convert csv to json using header column as json key

go install github.com/tmrtmhr/csv2json

Usage

csv2json -delimiter="\t" < sample.tsv

Sample Input/Output

  • Input
col1	col2	col3
1	2	3
4	"5
67"	8
9	10	11
  • Output
[
  {
    "col1": "1",
    "col2": "2",
    "col3": "3"
  },
  {
    "col1": "4",
    "col2": "5\n67",
    "col3": "8"
  },
  {
    "col1": "9",
    "col2": "10",
    "col3": "11"
  }
]