title: Transform javascript object
body: <p>This simple (as before, I thought) transformation of a JavaScript object defeats me. I would like to flatten this object in the following way.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>{
      "1": {
          "group": "Clothes",
          "brand": {
              "0": {
                  "brand_id": "12",
                  "brand_name": "Adidas"
              },
              "1": {
                  "brand_id": "15",
                  "brand_name": "Zara"
              }
          }
      },
      "2": {
          "group": "Cars",
          "brand": {
              "0": {
                  "brand_id": "43",
                  "brand_name": "Ferrari"
              },
              "1": {
                  "brand_id": "51",
                  "brand_name": "BMW"
              }
          }
      }
  }
  </code></pre>
  
  <p>And this is it, what I want to get</p>
  
  <pre><code>{0: {
      brand_id: "12",
      brand_name: "Adidas",
      group: "Clothes",
  }
  1: {
      brand_id: "15",
      brand_name: "Zara",
      group: "Clothes",
  },
  2: {
      brand_id: "43",
      brand_name: "Ferrari",
      group: "Cars",
  }
  3: {
      brand_id: "51",
      brand_name: "BMW",
      group: "Cars",
  }}
  </code></pre>
  
  <p>I tried using <code>.reduce()</code> or <code>.map()</code> but ineffectively.</p>