# How to use the same params in respond\_to for some formats?

**URL:** <https://www.ruby-forum.com/t/how-to-use-the-same-params-in-respond-to-for-some-formats/181220>\
**Category:** Rails\
**Created:** [January 7, 2010, 2:21pm UTC](https://www.ruby-forum.com/t/how-to-use-the-same-params-in-respond-to-for-some-formats/181220 "2010-01-07T14:21:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camilleroux](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/4491bb/32.png) [@camilleroux](https://www.ruby-forum.com/u/camilleroux)\
**Post date:** [January 7, 2010, 2:21pm UTC](https://www.ruby-forum.com/t/how-to-use-the-same-params-in-respond-to-for-some-formats/181220/1 "2010-01-07T14:21:09Z")

</div>

Hello,

I want to make an API in XML and JSON (maybe more), and I want most of  
the time use the same parameters for the to\_xml and the to\_json at least  
(same :include, :only, :except, :methods).  
What is the best way to do that?

Thank you,  
Camille R.
