How do I convert a Hash to a JSON string in Ruby 1.9? January 1, 2024 by Tarik That’s just because of String#inspect. There are no backslashes. Try: hjs = hash.to_json puts hjs