• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/component/ustatonline.php
  • Класс: BitrixIntranetComponentUstatOnline
  • Вызов: UstatOnline::prepareToJson
static function prepareToJson(array $list): string
{
	foreach ($list as $index => $element)
	{
		foreach ($element as $key => $value)
		{
			if (is_array($value))
			{
				$list[$index][$key] = array_change_key_case($value, CASE_LOWER);
			}
			else if ($value instanceof DateTime)
			{
				$list[$index][$key] = date('c', $value->getTimestamp());
			}
			else
			{
				$list[$index][$key] = $value;
			}
		}

		$list[$index] = array_change_key_case($list[$index], CASE_LOWER);
	}

	return BitrixMainWebJson::encode($list);
}