Today I learned that you can use jq
to convert JSON to CSV, which
can be useful if you want to import some data into a spreadsheet.
As an example, here's how you can get a CSV of everyone who's in space right now:
$ curl -s http://api.open-notify.org/astros.json | \ jq -r ".people[] | [.name, .craft] | @csv"
Which will give you this:
"Alexander Misurkin","ISS" "Mark Vande Hei","ISS" "Joe Acaba","ISS" "Anton Shkaplerov","ISS" "Scott Tingle","ISS" "Norishige Kanai","ISS"
You can read
more about the @csv
filter
over at programminghistorian.org.