-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected character #to_json #14032
Comments
What is your expected behavior? I saw you are using irb, is this a Rails bug? |
Which Rails version are using? How can I reproduce it? |
This is the correct behaviour – escape_html_entities_in_json is turned on by default as a security measure. If this is causing problem, you can turn it off by setting However, this is unlikely to cause problems, because according to the JSON spec this is perfectly valid and should be treated as identical as |
Hi Guys, Sorry, was looking for a solution to this problem. This problem occurred when ActiveSupport 4.0.2 upgrade. Repository is: https://github.com/ggoral/resource-booking-system.git $bundle exec rake console following the error reaches overwriting # to_json @rafaelfranca is not an application rails, app depends on ActiveRecord, which in turn depends on ActiveSupport, which overrides the #to_json method. @chancancode "ActiveSupport.escape_html_entities_in_json = false" works! 👍 Thanks everyone! |
@ggoral Make sure you know what you're doing if you turned that off :) I think you shouldn't have to do that in pretty much any scenarios, because again, when it comes to JSON, |
@chancancode Thank you for your clarification. |
irb(main):002:0> '&'.to_json
=> ""\u0026""
The text was updated successfully, but these errors were encountered: