title: Ruby 1.8.7 ordering of a hash with JSON.parse
body: <p>I've been having trouble figuring this out so I figured i'd ask here. I'm using Ruby 1.8.7 and RoR 1.2.6. I have my controller rendering this JSON:</p>
  
  <pre><code>{
    "form_id": "1",
    "form_structure": {
      "3": {
          "answer_required": "undefined",
          "title": "This is a radio group, right?",
          "cssClass": "radio",
          "values": {
              "4": {
                  "value": "Yes",
                  "baseline": "undefined"
              },
              "5": {
                  "value": "No",
                  "baseline": "undefined"
              },
              "7": {
                  "value": "Maybe",
                  "baseline": "undefined"
              },
              "20": {
                  "value": "Test",
                  "baseline": "undefined"
              }
          }
      }
    }
  }
  </code></pre>
  
  <p>As you can see, the options under "values" are ordered by the ID from the table. Looks perfect in JSON. When I use <code>JSON.parse</code> on it, everything under "values" get's all out of whack and it returns this: </p>
  
  <pre><code>{
    "form_id"=&gt;"1",
    "form_structure"=&gt;{
      "3"=&gt;{
          "title"=&gt;"This is a radio group, right?",
          "cssClass"=&gt;"radio",
          "answer_required"=&gt;"undefined",
          "values"=&gt;{
              "7"=&gt;{
                  "baseline"=&gt;"undefined",
                  "value"=&gt;"Maybe"
              },
              "20"=&gt;{
                  "baseline"=&gt;"undefined",
                  "value"=&gt;"Test"
              },
              "4"=&gt;{
                  "baseline"=&gt;"undefined",
                  "value"=&gt;"Yes"
              },
              "5"=&gt;{
                  "baseline"=&gt;"undefined",
                  "value"=&gt;"No"
              }
          }
      }
    }
  }
  </code></pre>
  
  <p>This code is used in a formbuilder that I'm making, and it wouldn't really be nice if the form elements that a person builds don't show up in the correct order that they built them in. Anyone have insights on how I can keep the ordering or reorder them as I output or right before then?</p>