# How does Rails respond to Ajax with JSON?

**URL:** <https://www.ruby-forum.com/t/how-does-rails-respond-to-ajax-with-json/192424>\
**Category:** Rails\
**Created:** [July 30, 2010, 1:43am UTC](https://www.ruby-forum.com/t/how-does-rails-respond-to-ajax-with-json/192424 "2010-07-30T01:43:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![winterheat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7993a0/32.png) [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Post date:** [July 30, 2010, 1:43am UTC](https://www.ruby-forum.com/t/how-does-rails-respond-to-ajax-with-json/192424/1 "2010-07-30T01:43:42Z")

</div>

In Ruby on Rails, why

```
= render :json => array_data

```

shows nothing (as seen in Firebug, the GET in the console), but

```
- response.content_type = "application/json"
= render :text => array_data.to_json

```

shows the data array?
