I’m outputting some database objects as static JSON files using a stand
along ruby script.rb, that other could run outside of my rails app. When
I use this script, the output replaces “&” with “\u0026.” If I use the
same code to output my JSON files in console, it outputs fine.
I imagine there is some gem or something I’m not including in my
script.rb that would resolve this. Thoughts?
I’m outputting some database objects as static JSON files using a stand
along ruby script.rb, that other could run outside of my rails app. When
I use this script, the output replaces “&” with “\u0026.” If I use the
same code to output my JSON files in console, it outputs fine.
I imagine there is some gem or something I’m not including in my
script.rb that would resolve this. Thoughts?
If you’re using ActiveSupport’s json stuff then
ActiveSupport::JSON::Encoding.escape_html_entities_in_json controls
this (although
\u0026 is perfectly u legal way of representing &)
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.