[Solved] How to filter objects with different keys in array?


Actually you need to use for loop if it’s not working with filter and map. I would suggest you to access date according to keys from the above arrays

let x = {
      "name": "Ola",
      "dates": [
        {
          "7.01.2020": [1, 2, 3]
        },
        {
          "8.01.2020": [4, 5, 6]
        },
        {
          "9.01.2020": [7, 8, 9]
        }
      ],
      "id": 7
    }
    
    let y = Object.values(x.dates);
    for(const [key,value] of Object.entries(y))
    {
    //getting particular date string
      result = Object.keys(value);
      console.log(result);
      //converted date for result
      date = new Date(result);
      console.log(date);
    }

please change include your required logic for return date.

1

solved How to filter objects with different keys in array?