What is to_js and to_json?

http://www.noobkit.com/show/ruby/ruby/standard-library/json.html

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:
http://www.json.org/

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?