Skip to content

Instantly share code, notes, and snippets.

@colemanm
Last active December 16, 2015 01:29
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 colemanm/5355437 to your computer and use it in GitHub Desktop.
Save colemanm/5355437 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'json'
require 'fileutils'
data = JSON.parse(File.read(ARGV[0]))
sorted = JSON.parse(Hash[*data.sort.flatten].to_json)
json = []
json << "["
sorted.each do |code,name|
json << " {"
json << " \"name\": \"#{name}\",\n"
json << " \"code\": \"#{code}\"\n"
json << " },"
end
json << "]"
puts json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment