I have an array of objects like so:
{
"openingDates": [
{
"location": "Main St.",
"openingDate": "2023-01-09T00:00:00Z"
},
{
"location": "Northwood Park",
"openingDate": "2006-01-10T00:00:00Z"
}
]
}
I have an expression to sort by openingDate then get the openingDate value:
sort_by(openingDates, &openingDate)[0].openingDate
However, openingDates
can potentially be null
, which will obviously cause an error if I try to run a sort on it. Is there a way to prevent the sort in my expression if the value is null
?