Skip to content

Instantly share code, notes, and snippets.

@wulftone
Created May 17, 2013 04:35
Show Gist options
  • Save wulftone/5596944 to your computer and use it in GitHub Desktop.
Save wulftone/5596944 to your computer and use it in GitHub Desktop.
Made specifically for a Trello project, this script will troll through your Trello JSON export data and pick out the names of your Trello cards and Lists, and save them to a new file.
#! /usr/bin/ruby
# This file is intended to be used for a specific trello project, but the principle
# displayed here of extracting data from a trello json export file can be used in
# a wide variety of ways. Edit this file to your heart's content!
#
# Put this file in the same folder as "lindy-hop-thesaurus.json" (or whatever your
# Trello export file is called... and run it from the command line like this:
#
# ruby print_json.rb lindy-hop-thesaurus.json
#
# It will output a file in the same directory called "data.txt" that contains the
# information you desire
require 'json'
require 'pp'
json = File.read ARGV[0]
hash = JSON.parse json
File.open('data.txt', 'w') do |file|
hash['cards'].each do |card|
file.write card['name'] + "\n"
end
file.write "\n"
hash['lists'].each do |list|
file.write list['name'] + "\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment