I have, what I believe to be, an array of objects:
[{"Id":1,"productId":122,"product_quantity":1}, {"Id":1,"productId":133,"product_quantity":2},{"Id":2,"productId":144,"product_quantity":1}]
I am using this code to get all the values:
$.each(JSON.parse(myArray), function(key, value){ // stuff }
I am trying to filter on Id and return the results associated with it. I have tried nesting .each and using if(value.id = myVariableID)
but nothing seems to work.
I would like to return (where Id = 1)
:
id : 1 | productID : 122 | product_quantity: 1, id : 1 | productID : 133 | procuct_quantity: 2
as an example.