From JSON to js array?

My json
{
 "products": [{
 "id": 4,
 "amount": 1
 }, {
 "id": 2,
 "amount": 1
}]
}


My code
var obj = JSON.parse('{ "products": [{ "id": 4, "amount": 1},{ "id": 2, "amount": 1}] }');
 And how now to cause it? So obj.amount?
April 7th 20 at 10:55
1 answer
April 7th 20 at 10:57
Solution
No. Why the array to refer to both the object?

obj['products'][0]['amount']

Find more questions by tags JavaScript