I want to convert object1 to object2 dynamically because keys like apple and water and inside objects are not static.
const object1 = {
apple:[
{a:''},
{b:''}
],
water:[
{c:''},
{d:''}
]
}
convert to this form:
object2 = {
apple:{a:'',b:''},
water:{c:'',d:''}
}