How do you create pretty json in CHEF (ruby)
How would you make an erb template that has human readable json? The following code works, but it makes a flat json file default.rb default['foo']['bar'] = { :herp => 'true', :derp => 42 } recipe.rb template "foo.json" do source 'foo.json.erb' variables :settings => node['foo']['bar'].to_json action :create end foo.json.erb <%= @settings %> Similar SO questions Chef and ruby templates - how to loop though key value pairs? How can I "pretty" format my JSON output in Ruby on Rails? spuder As pointed out by this SO Answer .erb templates are great for HTML, and XML, but is not good for json.