go-csv2json

command module
v0.0.0-...-d56cb40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 9 Imported by: 0

README

go-csv2json

This is a tool to transform a CSV file into a JSON one. It will parse all CSV rows from a file into a JSON array and output the result into a .json file. Each data cell will be parsed as a string datatype.

How to use it

$ ./csv2json [options] <csvFilePath>

Example:

$ ./csv2json data.csv

The command above will create a data.json file at exactly the same dir location of data.csv

Options Available

  • pretty: if enabled, it will create a well-formatted JSON file instead of a compact one (one single line)
  • separator: to indicate which character is used to separate cells. Only accepted options are comma (default) or semicolon.

Example using options:

$ ./csv2json --pretty --separator=semicolon data.csv

The command above will create a formatted data.json file at exactly the same dir location of data.csv The row columns from this file are separated using semicolons instead of commas.

Learning Go

I made this tool with the only intention to practice my recently acquired Golang skills. Feel free to use the source code as a way of learning more about how to use this programming language. Especially for creating CLI tools.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL