That's just because of String#inspect. There are no backslashes. Try:
String#inspect
hjs = hash.to_jsonputs hjs
You're on the right track. to_json converts it to JSON format. Don't let the IRB output fool you -- it doesn't contain any backslashes.
to_json
Try this:puts hash.to_jsonand you should see this:{"hi":"sup","yo":"hey"}
puts hash.to_json
{"hi":"sup","yo":"hey"}
I don't have Ruby1.9 to test, but apparently you are getting the "inspect" view. Those backslashes are not there, they are just escaping the quotes. Run puts hash.to_json to check.