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

Latest commit

 

History

History
29 lines (25 loc) · 1.01 KB

README.md

File metadata and controls

29 lines (25 loc) · 1.01 KB

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?"
}