# What is to\_js and to\_json?

**URL:** <https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317>\
**Category:** Rails\
**Created:** [January 8, 2008, 6:24am UTC](https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317 "2008-01-08T06:24:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [January 8, 2008, 6:24am UTC](https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317/1 "2008-01-08T06:24:47Z")

</div>

Anyone can explain the method to\_js and to\_json

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [January 8, 2008, 6:45am UTC](https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317/2 "2008-01-08T06:45:26Z")

</div>

[http://www.noobkit.com/show/ruby/ruby/standard-library/json.html](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.

On Jan 8, 2008 3:54 PM, Ayyanar from Aspire Systems \<  
removed\_email\_address@domain.invalid\> wrote:

> ## Anyone can explain the method to\_js and to\_json
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [January 9, 2008, 3:09am UTC](https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317/3 "2008-01-09T03:09:30Z")

</div>

This is a nicely laid out description of the JavaScript Object  
Notation (JSON) serialization format:  
[http://www.json.org/](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.

---

<div class="post-metadata">

**Author:** ![ayyanar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/82dd89/32.png) [@ayyanar](https://www.ruby-forum.com/u/ayyanar)\
**Post date:** [January 9, 2008, 5:51am UTC](https://www.ruby-forum.com/t/what-is-to-js-and-to-json/125317/4 "2008-01-09T05:51:58Z")

</div>

Both are used for the same purpose?
