• Stars
    star
    802
  • Rank 56,815 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

command line tool to convert json to csv

json2csv

Converts a stream of newline separated json data to csv format.

Build Status GitHub release

Installation

pre-built binaries are available under releases.

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

go install github.com/jehiah/json2csv@latest

Usage

usage: json2csv
    -k fields,and,nested.fields,to,output
    -i /path/to/input.json (optional; default is stdin)
    -o /path/to/output.csv (optional; default is stdout)
    --version
    -p print csv header row
    -h This help

To convert:

{"user": {"name":"jehiah", "password": "root"}, "remote_ip": "127.0.0.1", "dt" : "[20/Aug/2010:01:12:44 -0400]"}
{"user": {"name":"jeroenjanssens", "password": "123"}, "remote_ip": "192.168.0.1", "dt" : "[20/Aug/2010:01:12:44 -0400]"}
{"user": {"name":"unknown", "password": ""}, "remote_ip": "76.216.210.0", "dt" : "[20/Aug/2010:01:12:45 -0400]"}

to:

"jehiah","127.0.0.1"
"jeroenjanssens","192.168.0.1"
"unknown","76.216.210.0"

you would either

json2csv -k user.name,remote_ip -i input.json -o output.csv

or

cat input.json | json2csv -k user.name,remote_ip > output.csv

More Repositories

1

go-strftime

go implementation of strftime
Go
134
star
2

urlnorm

Convert URL's to a normalized unicode format
Python
67
star
3

git-open-pull

convert a github issue into a pull request
Go
54
star
4

gomrjob

gomrjob - a Go Framework for Hadoop Map Reduce Jobs
Go
42
star
5

nsqauth-contrib

Useful companion apps for when using nsqauthd
Python
30
star
6

private_s3_httpd

Private HTTP Server for Amazon S3 content
Go
19
star
7

gtfs-data-exchange

GTFS Data Exchange
Python
16
star
8

countmin

an implementation of Count-Min Sketch, an approximate counting data structure for summarizing data streams, in golang
Go
13
star
9

sortdb

Make a sorted tsv or csv datafile available over HTTP
Go
13
star
10

host_pool

python library to track remote host state, and mark hosts as failed
Python
13
star
11

safe_streets

A collection of proposals for NYC Vision Zero
10
star
12

partychat-hooks

receive and post hooks into http://partychapp.appspot.com/
Python
10
star
13

intro.nyc

Quick search and short links for NYC Council Legislation
HTML
9
star
14

cwc

utilities for CyclistsWithCameras
Go
9
star
15

mta-turnstiles

visualization/data exploration app for NYC MTA Turnstile data
Python
9
star
16

nyc_legislation

A Mirror of NYC Legislation
Go
7
star
17

mysql-python

A clone of mysql-python from http://mysql-python.hg.sourceforge.net/hgweb/mysql-python/MySQLdb-2.0/
Python
7
star
18

nsq_sketch

nsq_sketch - a top-n view of data in a NSQ stream of json messages
Go
5
star
19

retrydb

RetryDB transparently retries *sql.DB operations against a secondary datasource.
Go
5
star
20

go-daemontools

Go library for managing daemontools (svc, svstat)
Go
4
star
21

pyflakes.tmbundle

TextMate bundle with python validation on save. (validation done by pyflakes)
4
star
22

JCKeyboardNotificationManager

Manage UIKeyboardWillShowNotification properly resizing views as a result
Objective-C
4
star
23

lru

Go library for caching arbitrary data with least-recently-used (LRU) eviction strategy
Go
3
star
24

gomodimports

Like goimports but for keeping a tidy go.mod file
Go
3
star
25

xmpp_ioloop

a XMPP client build on Tornado's IOLoop (works with talk.google.com)
Python
2
star
26

pulse

TurboBytes pulse
Go
2
star
27

95percentile

a C utility to calculate the 95th percentile
C
2
star
28

socrata_to_bigquery

A tool to copy public data to BigQuery
Go
2
star
29

repo_metadata

Generate stats about issues and comments on a github repo
Python
2
star
30

legislator

Go
2
star
31

csvfilter

A simple tool to filter for specific csv columns
Go
1
star
32

imessage_gif_indexer

Make a HTML index of MotionStill Gif's shared on iMessage
Go
1
star
33

i18n.tmbundle

TextMate bundle with shortcuts for i18n
1
star
34

google_group_settings_audit

A script to query google group settings api
Python
1
star
35

hows-my-enforcement.nyc

HTML
1
star