SyntaxFix
Write A Post
Hire A Developer
Questions
With formatting
require 'json' tempHash = { "key_a" => "val_a", "key_b" => "val_b" } File.open("public/temp.json","w") do |f| f.write(JSON.pretty_generate(tempHash)) end
Output
{ "key_a":"val_a", "key_b":"val_b" }