title: How to change my object from being only one object with arrays inside, to an array of objects?
body: <p>So I've got this part of a code where I'm creating response for my project. Now I've managed to create data, but I've got response that I need to changes.</p>
  <p>First here is my code:</p>
  <pre><code>exports.getById = (req, res) =&gt; {
    const id = req.params.a_id;
  
    articleService
      .getById(id)
      .then((article) =&gt; {
        bankService
          .getRates()
          .then((list) =&gt; {
            let prr = article.price;
            let price = parseFloat(prr.replace(/\.| ?€$/g, '').replace(',', '.'));
            let mjeseci = req.body.months;
  
            let ratanks = list.map((rata) =&gt;
              LoanJS.Loan(price, !mjeseci ? 60 : mjeseci, rata.NKS)
            );
  
            const kreditNKS = ratanks.map((index) =&gt; index.sum);
            const rataNKS = ratanks.map(
              (index) =&gt; index.installments[0].installment
            );
  
            let eks = list.map((stopa) =&gt; stopa.EKS);
            let name = list.map((ime) =&gt; ime.bank.name);
            let nks = list.map((stopa) =&gt; stopa.NKS);
            let type = list.map((ime) =&gt; ime.interest_type.name);
  
            res.status(200).json({
              kredit: {
                kreditNKS: kreditNKS,
                rataNKS: rataNKS,
                stopaEKS: eks,
                stopaNKS: nks,
                tip: type,
                ime: name,
              }
          })
          .catch((err) =&gt; {
            res.status(500).send('Error 1 -&gt;' + err);
          });
      })
      .catch((err) =&gt; {
        res.status(500).send('Error -&gt;' + err);
      });
  };
  
  </code></pre>
  <p>Explain of what it does: So I'm fetching single article from my DB which has price inside it, then I'm getting data about loan also from DB. Now I'm using that data from DB, using <code>.map</code> function to get values one by one and calculating for that values my final loan(that is <code>ratanks</code> part). Now I'm also extracting some other data that I need present to the user on the frontend.</p>
  <p>Now my problem: It's sending my <code>res</code> as an object with one object, who has key:value pairs and values are array of data inside it. But I want it to be an array with multiple objects.</p>
  <p>My response in postman right now:</p>
  <pre><code>{
      &quot;kredit&quot;: {
          &quot;kreditNKS&quot;: [
              118406.54,
              118348.2,
              119400.33,
              118022.46,
              118262.44,
              118811.84
          ],
          &quot;rataNKS&quot;: [
              19734.42,
              19724.7,
              19900.05,
              19670.41,
              19710.41,
              19801.97
          ],
          &quot;stopaEKS&quot;: [
              &quot;6.24&quot;,
              &quot;5.65&quot;,
              &quot;8.26&quot;,
              &quot;3.13&quot;,
              &quot;4.03&quot;,
              &quot;5.68&quot;
          ],
          &quot;stopaNKS&quot;: [
              &quot;4.11&quot;,
              &quot;3.94&quot;,
              &quot;7&quot;,
              &quot;2.99&quot;,
              &quot;3.69&quot;,
              &quot;5.29&quot;
          ],
          &quot;tip&quot;: [
              &quot;Fiksna&quot;,
              &quot;Promjenjiva&quot;,
              &quot;Fiksna&quot;,
              &quot;Promjenjiva&quot;,
              &quot;Fiksna&quot;,
              &quot;Fiksna&quot;
          ],
          &quot;ime&quot;: [
              &quot;ZiraatBank&quot;,
              &quot;ZiraatBank&quot;,
              &quot;UniCredit&quot;,
              &quot;Raiffeisen Bank&quot;,
              &quot;Raiffeisen Bank&quot;,
              &quot;ASA Banka&quot;
          ]
      }
  }
  </code></pre>
  <p>Where I need it to be something like this:</p>
  <pre><code>[
     {
        &quot;kreditNKS&quot;:118406.54,
        &quot;rataNKS&quot;: 19734.42,
        &quot;stopaEKS&quot;: &quot;6.24&quot;,
        &quot;stopaNKS&quot;: &quot;4.11&quot;,
        &quot;tip&quot;: &quot;Fiksna&quot;,
        &quot;ime&quot;: &quot;ZiraatBank&quot;
     },
     {
        &quot;kreditNKS&quot;:118348.2,
        &quot;rataNKS&quot;: 19724.7,
        &quot;stopaEKS&quot;: &quot;5.65&quot;,
        &quot;stopaNKS&quot;: &quot;3.94&quot;,
        &quot;tip&quot;: &quot;Promjenjiva&quot;,
        &quot;ime&quot;: &quot;ZiraatBank&quot;
     },
     {
        &quot;kreditNKS&quot;:119400.33,
        &quot;rataNKS&quot;: 19900,05,
        &quot;stopaEKS&quot;: &quot;8.26&quot;,
        &quot;stopaNKS&quot;: &quot;7&quot;,
        &quot;tip&quot;: &quot;Fiksna&quot;,
        &quot;ime&quot;: &quot;UniCredit&quot;
     }
     etc.....
  ]
  </code></pre>
  <p>Is it possible to modify something like this?</p>
  <p>Any tips are welcome!
  Thanks!</p>