Need a jsonata magician!

Instead of trying to manipulate each field inside a separate change node rule, I would tend to process the entire array of 7 days into a single global.Weather object --

because it looks like each day can use the same expression to do the restructuring:

(
    $daysTime := function($idx) {(
        $idx = 0 ? "Today" :
            $idx = 1 ? "Tomorrow" :
            $idx & "DaysTime"
    )};

    payload#$i {
        $daysTime($i): {
            "Description": precis,
            "Temperature": {
                "Minimum": $parseInteger(air_temperature_min, '0'),
                "Maximum": $parseInteger(air_temperature_max, '0')
            }
        }
    }
)

Only the field name "XDaysTime" requires a function, based on the index in the original weather data array (0 is Today, 1 is Tomorrow, etc).

Love jsonata or hate it, to me that looks pretty readable -- and the output structure is shown right in the nesting of the expression itself. BTW, next time please include the actual data as some JSON we can copy, rather than as a screen capture...

1 Like