# To\_json conflict with json gem and rails 2.1

**URL:** <https://www.ruby-forum.com/t/to-json-conflict-with-json-gem-and-rails-2-1/157423>\
**Category:** Rails\
**Created:** [January 11, 2009, 3:58am UTC](https://www.ruby-forum.com/t/to-json-conflict-with-json-gem-and-rails-2-1/157423 "2009-01-11T03:58:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addywaddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ea5d25/32.png) [@addywaddy](https://www.ruby-forum.com/u/addywaddy)\
**Post date:** [January 11, 2009, 3:58am UTC](https://www.ruby-forum.com/t/to-json-conflict-with-json-gem-and-rails-2-1/157423/1 "2009-01-11T03:58:28Z")

</div>

hey folks,

this has been brought up twice in this group and once in rails core,  
but I couldn’t find a solution.

Specifically, I’m using the twitter gem within my rails project, and  
this eventually loads in the json gem. It wreaks havoc and throws  
this error:

wrong argument type Hash (expected Data)

when calling .to\_json.

The problem is that it the json gem and active\_support create  
different to\_json method signatures for data types like date, time,  
etc.

What is the preferred way to work around this issue? I’ve tried all  
the different loading combinations that I can think of (require ‘json’  
before and after active\_support, etc), but with no luck. Has anyone  
solved this issue? (lets assume I have to load both active\_support  
and json)

Thanks in advance!  
Adam

---

<div class="post-metadata">

**Author:** ![addywaddy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ea5d25/32.png) [@addywaddy](https://www.ruby-forum.com/u/addywaddy)\
**Post date:** [February 2, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/to-json-conflict-with-json-gem-and-rails-2-1/157423/2 "2009-02-02T17:10:40Z")

</div>

same problem here, any solution yet?
