title: How to create a JSON structure in Ruby manually?
body: <p>I spent last couple of hours of trying to manually (without Active Record to create a structure like this, taken from an API's documentation:</p>
  
  <pre><code>params_map = '{ "field1" =&gt; {"field1a"=&gt;"some text"},
                  "field2" =&gt; {
                    "field2a"  =&gt; "a",
                    "field2b"  =&gt; "b",
                    "field2c"  =&gt; "c",
                    "field2d"  =&gt; {"field2d_a" =&gt; "2d_a"},
                    "field2e"  =&gt; "e",
                    "items"    =&gt; [
                      { "items_a" =&gt; "1", 
                        "items_b" =&gt; "2",
                        "items_c" =&gt; "3",
                        "items_d" =&gt; "4"
                      },
                      { "items_e" =&gt; "5", 
                        "items_f" =&gt; "6",
                        "items_g" =&gt; "7",
                        "items_h" =&gt; "8"
                      }]
                  },
                  "field3" =&gt; "field3 text",
                  "field4" =&gt; "field4 text"}'
  params_map_eval = eval(params_map)
  </code></pre>
  
  <p>How can I create this in Ruby? I tried to create it as a Hash using <code>Hash.new</code>, also as a JSON, but I failed at adding/appending another fields to the big JSON.</p>
  
  <p>The <code>items</code> will be a loop and I'll populate it from database, but how do I create this structure in Ruby?</p>