# As\_json not honouring the options hash

**URL:** <https://www.ruby-forum.com/t/as-json-not-honouring-the-options-hash/188192>\
**Category:** Rails\
**Created:** [May 7, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/as-json-not-honouring-the-options-hash/188192 "2010-05-07T12:03:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arpita\_Roy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@Arpita\_Roy](https://www.ruby-forum.com/u/Arpita_Roy)\
**Post date:** [May 7, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/as-json-not-honouring-the-options-hash/188192/1 "2010-05-07T12:03:17Z")

</div>

I am new to ROR. I have been going through the article regarding  
as\_json [Rails to\_json or as\_json? - Jonathan Julian](http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/)

but i could not make as\_json work with options hash . When i am using  
as\_json with options, it is not honoring the options and returning the  
entire object.So a call like  
render :json =\> {:user.as\_json(:only =\> [:email] , :methods =\>  
[:getName]} does not work as expected and returns the whole user  
object and disregards the :methods and :only. Can anyone suggest any  
solution for this?
