NoMethodError: undefined method `[]' for #<JSON::Ext::Generator::State:0x2407ea8>

Trying to move a project to Rails 2.3.3, and getting the following:

NoMethodError: undefined method `[]' for #<JSON::Ext::Generator::State:
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/
active_support/json/encoders/hash.rb:45:in `as_json'
  from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/
active_support/json/encoders/hash.rb:34:in `to_json'

I understand that the to_json/as_json stuff changed, but this is for
something simple (using just hashes) like:


I'm using latest json gem, tried requiring active_support before json,
and put this into my environment as suggested by the Rails upgrade

  ActiveSupport::JSON.backend = 'JSONGem'

No dice.
If I use Rails 2.3.2, it's happy.

Anyone encounter/conquer this?


After sleeping on it for a night, I replaced all instance of
'JSON.generate(hash)' with hash.to_json, solving the problem.

Posting this for posterity and those googling the issue.

Ya, they changed how parse/generate works I think it accepts/returns arrays now. Changing the behavior of a gem like that is wrong. Can we get this changed back please?