Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

Sydsvenskan/json2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON to CSV conversion

GoDoc Goreport Build Status codecov

Converts arbitrary JSON data to CSV. Does it make sense? Not always, but it can be useful for the right use-case :)

Usage:

func main() {
	json2csv.Convert(strings.NewReader(`[
{
  "foo": "bar",
  "baz": [{"a":"b"}, 1, 1.3]
},
{
  "foo": "fi fum",
  "baz": [{"a":"c"}, 3],
  "extra": "fine"
},
"it's JSON, what do you expect?"
]`), os.Stdout)
	// Output:
	// baz.0.a,baz.1,baz.2,extra,foo,text
	// b,1,1.3,,bar,
	// c,3,,fine,fi fum,
	// ,,,,,"it's JSON, what do you expect?"
}