--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You could Base64 encode the JSON and decode it on the client-side with
JavaScript.
I am ABSOLUTELY NOT recommending that you do this, but simply stating
that it could work. Still a bad design idea IMHO.
--
Posted via http://www.ruby-forum.com/.
I've had to do this in a helper that was constructing a complicated
object, and I think this is similar to your problem:
1) enumerate through all the parts of your object that could contain
dangerous data and call h() on them.
2) call raw(your_object.to_json) on the result.
It's definitely not an easy, generic solution, but it gets you past
this problem.
Honestly if you are going to process the JSON with Javascript what
dont you write your data out as Javascript data structures (which it
would be converted from JSON anyway) in the page and process that?
What do you gain from embedding the JSON then having to convert it
into Javascript data structures over just writing the native
Javascript data structures?