in a module “Search” i get this response
{
“data”: {
“records”: {
“2025-03-12”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”,
“not_needed”:“x”,
“not_needed2”:“x”
}
],
“2025-03-13”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”,
“not_needed”:“x”,
“not_needed2”:“x”
},
{
“user_id”: 6,
“first_name”: “Alex”,
“last_name”: “Marinkovic”,
“not_needed”:“x”,
“not_needed2”:“x”
}
],
“2025-03-14”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”,
“not_needed”:“x”,
“not_needed2”:“x”
},
{
“user_id”: 6,
“first_name”: “Alex”,
“last_name”: “Marinkovic”,
“not_needed”:“x”,
“not_needed2”:“x”
}
]
}
}
}
i want to iterate in every object of “records” and foreach of these, to iterate and keep only the data needed (in my json above the not_needed fields are the one to ignore), so to output a result like
{
“2025-03-12”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”
}
],
“2025-03-13”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”
},
{
“user_id”: 6,
“first_name”: “Alex”,
“last_name”: “Marinkovic”
}
],
“2025-03-14”: [
{
“user_id”: 5,
“first_name”: “Ponnappa”,
“last_name”: “Priva”
},
{
“user_id”: 6,
“first_name”: “Alex”,
“last_name”: “Marinkovic”
}
]
}
how to achieve that?