generate json from a hash in ruby