Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
write JSON file data to multiple files [ruby]
require 'active_support'
require 'active_support/core_ext'
require 'json'
JSON.parse("./_data/companies.json").read).each do |company|"./_companies/#{company['name'].parameterize}.md", "w") do |f|
f.write "---\n"
f.write "layout: company\n"
f.write "title: #{company['name']}\n"
f.write "categories: prep\n"
f.write "website: '#{company['website']}'\n"
f.write "location: #{company['location']}\n"
f.write "---\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.