title: Create a JSON Array within Array in node.js
body: <p>i am trying to construct a JSON request that has two arrays in it, this is the end result i am looking for:</p>
  <pre><code>[
      {
          &quot;Policy&quot;: {
              &quot;Channel&quot;: &quot;online&quot;,
              &quot;Credit Score&quot;: &quot;20000&quot;,
              &quot;Car&quot;: [
                  {
                      &quot;Age&quot;: &quot;28&quot;,
                      &quot;AnnualMiles&quot;: &quot;15000&quot;,
                      &quot;CarAge&quot;: &quot;3&quot;,
                      &quot;Young Driver&quot;: &quot;1&quot;
                  }
              ]
          }
      }
  ]
  </code></pre>
  <p>i am trying to push two objects in the JSON Arrays,
  one into the root array (i attached this object to a variable called result):</p>
  <pre><code> {
          &quot;Channel&quot;: &quot;online&quot;,
          &quot;Credit Score&quot;: &quot;20000&quot;
      }
  </code></pre>
  <p>and the other one into the sub array (i attached this object to a variable called result2):</p>
  <pre><code>{
          &quot;Age&quot;: &quot;28&quot;,
          &quot;AnnualMiles&quot;: &quot;15000&quot;,
          &quot;CarAge&quot;: &quot;3&quot;,
          &quot;Young Driver&quot;: &quot;1&quot;
      }
  
  </code></pre>
  <p>The code i am trying to use is:</p>
  <pre><code>policy=new Array() 
  policy.car=new Array() 
  policy.push(result)
  policy.car.push(result2)
  console.log(policy)
  console.log(JSON.stringify(policy))
      response.status(200).json(policy)
  </code></pre>
  <p>i see that the JS object (policy) is constructed in the structure i was looking for, however the JSON i am getting back is just the first level:</p>
  <pre><code>[
      {
          &quot;Channel&quot;: &quot;online&quot;,
          &quot;Credit Score&quot;: &quot;20000&quot;
      }
  ]
  </code></pre>
  <p>what am i missing here?</p>