Prevent Rails from encoding the ampersands in a URL when outputting JSON

前端 未结 2 1029
栀梦
栀梦 2021-02-18 20:04

I have the following code:

render json: { image: image }

Image has an attribute \"url\". Let\'s say it\'s:

https://blah.com/a?A         


        
2条回答
  •  灰色年华
    2021-02-18 20:57

    your answer described there:

    Converting URL to JSON version?

    JSON encoding wrongly escaped (Rails 3, Ruby 1.9.2)

    Why does is Rails 4 unicode escaping in to_json

    Encoding JSON in href using encodeURI, Rails parsing (article)

    and also this would help you:

    Jbuilder

提交回复
热议问题