$cron = json_decode(shell_exec('/root/scripts/cron-health/cron-health.sh 2>&1'), true); $response = [ "ok" => $cron["ok"], // or combine with other subsystems "cron" => $cron, "other_subsystems" => [...] ]; echo json_encode($response);