Last active
August 11, 2021 16:51
-
-
Save danivovich/781760f3fd27cfc741aba1598ddae248 to your computer and use it in GitHub Desktop.
Zube JSON to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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