title: Express.js Typescript: How to send only some of the properties of all the objects in an array through res.json()
body: <p>Suppose I have an array of Persons with 3+ properties (e.g. name,age,height... and more), e.g.:</p>
  <pre><code>personArray = [new Person(&quot;Susan&quot;,25,170), new Person(&quot;Peter&quot;,23,220)];
  </code></pre>
  <p>And suppose I need to send over only <strong>some</strong> of the Person properties of all Persons through express.js res.json function, what is the most elegant way to write it in Typescript, so that the content in <code>res.json()</code> will be sent in this format?</p>
  <pre><code>{
   &quot;persons&quot;:[
      {
        &quot;name&quot;:&quot;Susan&quot;,
        &quot;age&quot;:25
      },
      {
        &quot;name&quot;:&quot;Peter&quot;,
        &quot;age&quot;:23
      },
      ...
    ]
  }
  </code></pre>
  <p>Please assume that there could be like 10+ properties and we need like only 5 to send over in res.json.
  To make things clear here I use only three total fields (name, age, height) and only two fields (name &amp; age) to send over.
  And yes all Persons in the Array needed to be sent over.</p>