<?
$x=0;
foreach($arResult['ITEMS'] as $arItem){
    
    $arResult["Headers"][$x]["NAME"] = $arItem["NAME"];
    $arResult["Headers"][$x]["CODE"] = $arItem["CODE"];
    $arResult["elements"][$x]["PREVIEW_TEXT"] = $arItem["PREVIEW_TEXT"];
    $arResult["elements"][$x]["CODE"] = $arItem["CODE"];
    $x++;
}

