title: How to add multiple types of objects to json array?
body: <p>I need to parse data to JSON in a particular format, which should look like this (notice that there are multiple types of objects in an array).</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;member details&quot;:
          [
              {
                  &quot;name&quot;: &quot;John Doe&quot;,
                  &quot;type&quot;: &quot;faculty&quot;,
                  &quot;teaching years&quot;: &quot;5&quot;,
                  &quot;faculty code&quot;: &quot;f154&quot;
              },
              {
                  &quot;name&quot;: &quot;Mary Storm&quot;,
                  &quot;type&quot;: &quot;student&quot;,
                  &quot;studying years&quot;: &quot;3&quot;,
                  &quot;student code&quot;: &quot;s19&quot;
              }
          ]
  }
  </code></pre>
  <p>How can I add multiple objects to a JSON array?</p>
  <p>I was thinking of interfaces. But what if none of the properties are common?</p>