javascript - JSON string created in Rails replaces whitespace with plus sign (+) -
javascript - JSON string created in Rails replaces whitespace with plus sign (+) - rails: object = object.find_by(params[:id]) object_items = { "1" => { :id => "123456", :name => "pancakes yum!" }, "2" => { :id => "789010", :name => "hello 123" }} cookies[:something] = { "id" => object.id, "title" => object.title, "object_items" => object_items }.to_json let's object.title produces string "hello world" cookie content: %7b%22id%22%3a2%2c%22title%22%3a%22hello+world%22%2c%22object_items%22%3a%7b%221%22%3a%7b%22id%22%3a%22123456%22%2c%22name%22%3a%22pancakes+yum!%22%7d%2c%222%22%3a%7b%22id%22%3a%22789010%22%2c%22name%22%3a%22hello+123%22%7d%7d%7d problem: the json string beingness created replaces/escapes whitespace plus sign ( + ) instead of %20 means if read string , grab value object.title in html/javascript read "hello+world...