c2j

command module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 7 Imported by: 0

README

C2J

Go Go Report Card codecov

A simple command line for convert CSV in JSON list of objects based on header.

Install

With Go 1.17 or higher:

go install github.com/edermanoel94/c2j
Usage
Convert

To convert, run the c2j command to read from STDIN, using standard delimiter, which is comma.

$ cat example_comma.csv | c2j
Convert with custom delimiter

Use the --delimiter or short version-d flag to specify a delimiter.

$ cat example_semicolon.csv | c2j --delimiter ";"

Requirements

Technically none of these are "required", but they c2j so much prettier.

Command-line JSON processor

jq

c2j does not come with json pretty, yet, will be added in future releases.

some_csv.csv | c2j <flags> | jq

Flags

Name Function
-d --delimiter Choose a delimiter for parse CSV
-H --no-header CSV without header fields

Exit Codes

Code Meaning
0 Good
-1 Bad

Demo

Demonstration

Todo

  • Convert without header and generate keys based on index
  • Save output to a file
  • Add a pretty output

Contributing

Pull requests for new features, bug fixes, and suggestions are welcome!

License

MIT

Live

I use Twitch to stream, follow me, to see new features on this project.

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