This project is archived and is in readonly mode.

#1485 ✓stale
Vlad R

json_escape eats away double quotes

Reported by Vlad R | November 26th, 2008 @ 08:53 PM | in 3.x

json_escape("hello".to_json) will incorrectly produce 'hello' instead of '"hello"'

rails/actionpack/lib/action_view/template_handlers/erb.rb or rails/actionpack/lib/action_view/erb/util.rb

def json_escape(s)
  s.to_s.gsub(/[&"><]/) { |special| JSON_ESCAPE[special] }

should probably read:

def json_escape(s)
  s.to_s.gsub(/[&><]/) { |special| JSON_ESCAPE[special] }

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by