Skip to content

Instantly share code, notes, and snippets.

@danivovich
Last active August 11, 2021 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danivovich/781760f3fd27cfc741aba1598ddae248 to your computer and use it in GitHub Desktop.
Save danivovich/781760f3fd27cfc741aba1598ddae248 to your computer and use it in GitHub Desktop.
Zube JSON to CSV
require 'json'
require 'csv'
data = JSON.parse(File.read("data.json"))
out = CSV.open("data.csv", "wb")
out << ["Number", "State", "Status", "Column", "Epic", "Labels", "Title", "Body"]
row = []
data.each do |record|
next if record["type"] == "pull_request"
out << [
record["number"],
record["state"],
record["status"],
record["category_name"],
(record["epic"]["title"] rescue ""),
record["labels"].map { |l| l["name"] }.join(","),
record["title"],
record["body"]
]
end
out.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment