# File activesupport/lib/active_support/json/encoding.rb, line 37
def encode(value)
unless options.empty?
value = value.as_json(options.dup.freeze)
end
json = stringify(jsonify(value))
# Rails does more escaping than the JSON gem natively does (we
# escape \u2028 and \u2029 and optionally >, <, & to work around
# certain browser problems).
if @options.fetch(:escape_html_entities, Encoding.escape_html_entities_in_json)
json.gsub!(">", '\u003e')
json.gsub!("<", '\u003c')
json.gsub!("&", '\u0026')
end
json.gsub!("\u2028", '\u2028')
json.gsub!("\u2029", '\u2029')
json
end