Using lodash .groupBy. How to group object inside an object
<p>I'm using lodash's _.groupBy to come up with the following data:</p>

<pre><code>{
   "Generic Drugs":[
                      {
                          itemDes: "Dulcolax",
                          itemGeneric: "Bisacodyl",
                          price: '10'
                      },
                      {
                          itemDes: "Celine",
                          itemGeneric: "Ascorbic Acid",
                          price: '10'
                      },
                          {
                          itemDes: "Vitamic C",
                          itemGeneric: "Ascorbic Acid",
                          price: '10'
                      }
                   ],
  "None-generic Drugs" : [
                           {
                             itemDes: "test 1",
                             itemGeneric: "",
                             price: '10'
                           },
                           {
                             itemDes: "test 2",
                             itemGeneric: "",
                             price: '10'
                           }                                 
                   ]
}
</code></pre>

<p>I wanted to group the objects in Generic Drugs object by the property itemGeneric to come up an output like this: </p>

<pre><code>{
   "Generic Drugs":[
                      "Ascorbic Acid" : [  
                                          { itemDes: "Celine" }, 
                                          { itemDesc: "Vitamin C" }
                                        ],
                      "Bisacodyl" : [
                                       { itemDes: "Dolculax" } 
                                    ]
  "None-generic Drugs" : [
                           {
                             itemDes: "test 1",
                             itemGeneric: "",
                             price: '10'
                           },
                           {
                             itemDes: "test 2",
                             itemGeneric: "",
                             price: '10'
                           }                                 
                   ]
}
</code></pre>

<p>Please somebody help me with this problem. Thanks for the answers. :)</p>