There are orders: array[427] individual items and each one has another array inside it. please let me know if it's possible to loop through each array and get valid_till and return all of them on result.
I can get to the first found item in array with @Steve-Mcl answer here:
but I want it to loop through all the returned items and get objects that have the correct "valid_till" date
I am a noob at javascript, so please bear with me on this.
the valid_till will contain a date . Basically, I am getting a JSON array object from which I have to filter the object that contains a particular date.
So from the first example, If I search for a valid_till date like: "2022-10-12", I should get all objects that have that date inside the object.
As you can see, msg.payload is not an array. We assumed that the array you were showing us was in the payload. You need const results = msg.payload.orders.filter(v => v.valid_till == '2022-10-12' )