json2csv

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

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

Go to latest
Published: Jun 20, 2015 License: MIT Imports: 11 Imported by: 0

README

json2csv

convert a stream of newline separated json data to csv whitch supports json array.

Build Status

Installation

If you have a working golang install, you can use go get.

go get github.com/SunRunAway/json2csv

The binary build is here https://github.com/SunRunAway/json2csv/releases

Usage

usage: json2csv
  -d=",": delimiter used for output values
  -i="": /path/to/input.json (optional; default is stdin)
  -o="": /path/to/output.json (optional; default is stdout)
  -p=true: prints header to output

To convert:

{"user": {"name":"jehiah", "password": "root"}, "remote": [{"ip":"127.0.0.1", "port": 8080}]}
{"user": {"name":"jeroenjanssens", "password": "123"}, "remote": [{"ip":"10.0.0.1", "port": 1080}]}
{"user": {"name":"unknown", "password": ""}, "remote": [{"ip":"10.0.0.1", "port": 27017}, {"ip":"10.0.0.2", "port": 27017}]}

to:

remote[0].ip,remote[0].port,remote[1].ip,remote[1].port,user.name,user.password
127.0.0.1,8080,,,jehiah,root
10.0.0.1,1080,,,jeroenjanssens,123
10.0.0.1,27017,10.0.0.2,27017,unknown,

you would either

json2csv -i input.json -o output.csv

or

cat input.json | json2csv > output.csv

Thanks

Many thanks to jehiah which i copied some docs and user interface.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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