I have following array of objects :
[
{
"userId": 1,
"id": 1,
"title": "delectus aut",
"completed": false
},
{
"userId": 1,
"id": 2,
"title": "quis ut",
"completed": false
}
]
I want following as output :
userId | id | title | completed |
1 | 1 | delectus aut| false |
1 | 2 | quis ut | false |
I have tried following using lodash , but somehow I feel there us better solution than this, considering the number of loops:
jsonObject = response; // consider the above mention object here.
keys = _.keys(json[0]);
Here what I found is that json[0] will not in all case going to be same, so what is the best way to find the solution for this.
Any help will be appreciated!!!