I am new to JSON and Javascript. I have JSON object as below:
const text = {"recordset": [
{
"planned_date": "2020-06-29T00:00:00.000Z",
"quantity": 9,
},
{
"planned_date": "2020-07-06T00:00:00.000Z",
"quantity": 12,
},
{
"planned_date": "2020-07-13T00:00:00.000Z",
"quantity": 13,
},
{
"planned_date": "2020-07-20T00:00:00.000Z",
"quantity": 9,
}
]};
I tried to create a new array which only take the "quantity" as such but failed miserably:
for (i in text.recordset) {
for (j in text.recordset[i].quantity) {
newText += text.recordset[i].quantity[j]
}
}
What I want is new array as below:
const newText = [9, 12, 13, 9]