Skip to content

xjsonl is a tool to convert xSV to JSON Lines.

Notifications You must be signed in to change notification settings

winebarrel/xjsonl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xjsonl

xjsonl is a tool to convert xSV to JSON Lines.

Build Status

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