Skip to content

Instantly share code, notes, and snippets.

@mose
Last active February 16, 2016 18:11
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 mose/2502cac5a0ae34e79684 to your computer and use it in GitHub Desktop.
Save mose/2502cac5a0ae34e79684 to your computer and use it in GitHub Desktop.
require 'json'
file = ARGV[0]
unless file
puts "Usage: ruby #{$0} <json filename of the export>"
exit
end
unless File.exist? file
puts "File #{file} not found."
exit
end
content = JSON.parse(File.read(file))
lists = content['lists'].reduce({}) do |a, c|
a[c['id']] = c['name']
a
end
parsed = content['cards'].reduce('') do |a, c|
labels = c['labels'].reduce([]) do |x, l|
x << l['name']
x
end
a << "\"#{lists[c['idList']]}\";\"#{c['name']}\";\"#{labels.join(', ')}\"\n"
a
end
puts "\"Month\";\"Topic\";\"Labels\"\n"
puts parsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment