rewrite magic.rb to produce a single json file containing all category data