#!/usr/bin/env ruby require 'json' json = JSON.parse STDIN.read json['collections'][0]['posts'].each do |post| slug = post['slug'] title = post['title'] body = post['body'] f = File.open("blog/#{slug}.md", "w") f.write "# #{title}\n" f.write "\n" f.write body f.flush end