I have a hash
{:name =>"[email protected]"}
I am trying to convert this hash into the following JavaScript format.
{"name" : "[email protected]"}
I tried:
{:name=>"[email protected]"}.to_json
which gives the output:
"{\"name\":\"[email protected]\"}"
Parsing it with JSON gives:
JSON.parse({:name=>"[email protected]"}.to_json)
# => {"name"=>"[email protected]"}