title: Store array values in object in angular
body: <p>I want to store the array values in an object like below:</p>
  <pre><code>{&quot;newpublicareas&quot;:[{&quot;area_name&quot;:&quot;x&quot;,
                      &quot;level&quot;:0}]}
  </code></pre>
  <p>This is what i have done:</p>
  <pre><code>getNewTopLevelS(res){
  
  this.newpublicarea = []
  
  res.map((j)=&gt; {
  
    this.newpublicarea.push(j.body.data.areas)
  
  })
  this.entireareas.push(this.newpublicarea)
      }
  </code></pre>
  <p>But it is pushing in wrong format.</p>
  <p>Any suggestions?</p>