What is to_js and to_json?


May give an accurate enough overview. I find it very helpful for converting an array of values in Ruby to an array of values in Javascript.

This is a nicely laid out description of the JavaScript Object
Notation (JSON) serialization format:

Sorry, I'm unfamiliar with to_js method. Where is that one defined? I
didn't see it anywhere in the Rails documentation.

Both are used for the same purpose?