title: How to take a list of Objects and create a JSON of specific properties of the objects in the list?
body: <p>I have a list that looks like this:</p>
  
  <pre><code>[ Person({ getName: Function, id: '310394', age: 30 }), Person({ getName: Function, id: '244454', age: 31 })...]
  </code></pre>
  
  <p>and now I want to make it like this:</p>
  
  <pre><code>{
      peopleIds: [
           244454,244454...
    ]
  }
  </code></pre>
  
  <p>I did something like this:</p>
  
  <pre><code>public makePeopleIdJSON(list: Person[]):void {
      list.forEach(x =&gt; console.log(x.id))
    }
  </code></pre>
  
  <p>that just prints the id for each object in the list, but how do I make the output a json as requested above..?</p>
  
  <p>thanks allot</p>