Da testare:
Codice PHP:
$data json_decode($jsontrue);

foreach (
$data['attivita'] as &$attivita) {
    foreach (
$attività as &$valore) {
        
$valore is_array($valore) ? $valore : [$valore];
    }
}

print(
json_encode($dataJSON_PRETTY_PRINT));