This question refers to ruby ββ1.8, but it still stands at the top when searching.
in ruby> = 1.9 you can use
File.write("public/temp.json",tempHash.to_json)
besides what was mentioned in other answers, in ruby ββ1.8 you can also use one liner form
File.open("public/temp.json","w"){ |f| f.write tempHash.to_json }
Haseeb Eqx 19 Oct '17 at 11:59 on 2017-10-19 11:59
source share