如何将嵌套对象转换为一个对象

我想将下面的对象转换为特定格式

Product: {   "alias":"d8156ad9-06af-45ca-a8eb-17f6148f1bd2",
   "manufacturing_company":{
      "alias":"1",
      "name":"Company",
      "status":1

   },
   "form":{
      "alias":"2",
      "name":"Suppository",
      "status":1

   },
   "generic":{
      "alias":"1",
      "name":"Esomeprazole",
      "status":1
   },
   "name":"AA",
   "trading_price":15,
   "purchase_price":10,
   "pack_size":"10",
   "is_salesable":true,
   "primary_unit":{
      "alias":"1",
      "name":"Form1",
      "status":2
   },
   "secondary_unit":{
      "alias":"1",
      "name":"Form1",
      "status":2
   },
   "conversion_factor":25,
   "code":"201",
   "species":"drfgfgd",
   "strength":"96",
   "full_name":"AA 96",
   "status":1,
   "category":{
      "alias":"8",
      "name":"Test2",
      "status":1
   },
   "subgroup":{
      "alias":"4",
      "name":"CDCD",
      "status":1,
      "product_group":{
         "id":9,
         "alias":"1",
         "name":"zsdfasd",
         "status":1      
      } 
   }
}

Product: {   "alias":"d8156ad9-06af-45ca-a8eb-17f6148f1bd2",
   "manufacturing_company":"1",
   "form":"2",
   "generic":"1",
   "name":"AA",
   "trading_price":15,
   "purchase_price":10,
   "pack_size":"10",
   "is_salesable":true,
   "primary_unit":"1",
   "secondary_unit":"1",
   "conversion_factor":25,
   "code":"201",
   "species":"drfgfgd",
   "strength":"96",
   "full_name":"AA 96",
   "status":1,
   "category":"8",
   "subgroup":"4"
}