I have the below object
input = {a:1, b:2, c:3}
I want to covert it into the following
Output = [{ a: 1 }, { b: 2 }, { c: 3 }]
Also provide solution to vice versa i.e. array of objects to object.
I have tried using built-in methods like Object.entries but not getting the perfect solution.
Object.entries(obj).map(e => Object.fromEntries([e])),Object.fromEntries(arr.flatMap(o => Object.entries(o)))