My API returns below data in nodejs.
console.log(body) prints the below.
{
"items": [
{
"PlanId": 2007,
"PlanCode": "Future Mat Cost Planning - Budget",
"Description": "Future Mat Cost Planning - Budget",
"FromMonth": "2019-10-01T00:00:00+00:00"
},
{
"PlanId": 3001,
"PlanCode": "Nvidia Cost PL",
"Description": "Nvidia Cost PL",
"FromMonth": "2019-10-01T00:00:00+00:00"
},
{
"PlanId": 1001,
"PlanCode": "Material Cost Planning - PO",
"Description": "Material Cost Planning - PO",
"FromMonth": "2019-10-01T00:00:00+00:00"
}
],
"count": 5,
"hasMore": true,
"limit": 5,
"offset": 0
}
I have to create object in which I have to store PlanId and plancode. How can i do that. I need to store data in key value format. can anybody help me to create either array or object? I am new to nodejs
I want result like this.
obj=[{
"PlanId": 3001,
"PlanCode": "Nvidia Cost PL",
},
{
"PlanId": 1001,
"PlanCode": "Material Cost Planning - PO",
}
];