title: JSON separate object to new objects if array's length is longer than 1
body: <p>Edit: Answers don't work if there's more objects inside JSON :/
  If you can take a look one more time I would be grateful.</p>
  
  <p>I am trying to seperate JSON array to make new objects with single arrays.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const objs = [{
    id: ["18772729849", "17773133341", "17773173696"],
    o: 552750,
    g: 2,
    p: 5427.37,
    f: ["0.07480893", "0.07703563", "0.07160716"],
    b: ["76561198311594977", "76561198311424548", "76561198312084911"],
    d: ["uYEY1BQ", "jSdgIK5", "lldBCJt"],
  },
  {
    id: ["5122519", "7125125", "124124"],
    o: 12440,
    g: 412,
    p: 4124,
    f: ["0.033", "0.0123", "0.412412"],
    b: ["76561198124421421", "712412441248", "71241244911"],
    d: ["uYasdasd1BQ", "jSasdasdK5", "llfasCJt"],
  }
  ];</code></pre>
  </div>
  </div>
  </p>
  
  <p>And my output should look like that:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[{
    id: ['18772729849'],
    o: 552750,
    g: 2,
    p: 5427.37,
    f: ['0.07480893'],
    b: ['76561198311594977'],
    d: ['uYEY1BQ']
  },
  {
    id: ['17773133341'],
    o: 552750,
    g: 2,
    p: 5427.37,
    f: ['0.07703563'],
    b: ['76561198311424548'],
    d: ['jSdgIK5']
  },
  {
    id: ['17773173696'],
    o: 552750,
    g: 2,
    p: 5427.37,
    f: ['0.07160716'],
    b: ['76561198312084911'],
    d: ['lldBCJt5']
  },
  {
    id: ['5122519'],
    o: 12440,
    g: 412,
    p: 4124,
    f: ['0.033'],
    b: ['76561198124421421'],
    d: ['uYasdasd1BQ']
  },
  {
    id: ['7125125'],
    o: 12440,
    g: 412,
    p: 4124,
    f: ['0.0123'],
    b: ['712412441248'],
    d: ['jSasdasdK5']
  },</code></pre>
  </div>
  </div>
  
  etc</p>
  
  <p>So "o", "g", "p" stays the same as in original object.</p>
  
  <p>Solution:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const objs = [{ id: ["18772729849", "17773133341", "17773173696"], o: 552750, g: 2, p: 5427.37, f: ["0.07480893", "0.07703563", "0.07160716"], b: ["76561198311594977", "76561198311424548", "76561198312084911"], d: ["uYEY1BQ", "jSdgIK5", "lldBCJt"],},{ id: ["5122519", "7125125", "124124"], o: 12440, g: 412, p: 4124, f: ["0.033", "0.0123", "0.412412"], b: ["76561198124421421", "712412441248", "71241244911"], d: ["uYasdasd1BQ", "jSasdasdK5", "llfasCJt"]}];
  
  var result = objs.flatMap(obj=&gt;{
    return Array.from({length:obj.id.length},(_,i)=&gt;Object.fromEntries(
    Object.entries(obj).map(([key, val])=&gt;[key, Array.isArray(val) ? [val[i]] : val])
    ));
  });
  
  console.log(result);</code></pre>
  </div>
  </div>
  </p>