Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/winebarrel/xjsonl

xjsonl is a tool to convert xSV to JSON Lines.
https://github.com/winebarrel/xjsonl

csv golang json tsv

Last synced: 1 day ago
JSON representation

xjsonl is a tool to convert xSV to JSON Lines.

Awesome Lists containing this project

README

        

# xjsonl

xjsonl is a tool to convert xSV to JSON Lines.

[![Build Status](https://travis-ci.org/winebarrel/xjsonl.svg?branch=master)](https://travis-ci.org/winebarrel/xjsonl)

## Usage

```
Usage of xjsonl:
-header
consider the first line as a header
-keys string
json object keys
-sep string
line separator. not split if empty (default ",")
-version
print version and exit
```

```
$ printf 'foo,bar\nbar,zoo' | xjsonl
["foo","bar"]
["bar","zoo"]

$ printf 'foo\tbar\nbar\tzoo' | xjsonl -sep '\t'
["foo","bar"]
["bar","zoo"]

$ printf 'foo,bar\nbar,zoo' | xjsonl -sep ''
["foo,bar"]
["bar,zoo"]

$ printf 'foo,bar\nbar,zoo' > data.csv
$ xjsonl data.csv
["foo","bar"]
["bar","zoo"]

$ printf 'foo,bar\nbar,zoo' | xjsonl -keys a,b
{"a":"foo","b":"bar"}
{"a":"bar","b":"zoo"}

$ printf "foo,bar\nzoo,baz\n1,2" | xjsonl -header
{"foo":"zoo","bar":"baz"}
{"foo":"1","bar":"2"}
```

## Related Links

* https://github.com/winebarrel/xjr