This project is archived and is in readonly mode.

#652 ✓committed
Noel Rappin

Stack error with Hash.to_json for nested number values

Reported by Noel Rappin | July 18th, 2008 @ 04:51 PM | in 2.x

Here's the test

    hash = {
      "CHI" => {
        :dislay_name => "chicago",
        :latitude => 123.234
      }
    }
    result = hash.to_json

And the result

Error:
test: Institution should output json. (InstitutionTest):
SystemStackError: stack level too deep
    /Users/noel/Projects/botanic/plant_collections/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/json/encoding.rb:29

Poking around, converting the number to a string did not trigger the problem, and using a flat hash rather than a nested hash also did not. I'm wondering if this is a odd side effect of the stack check to avoid circular references?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages