# groupFormat (/docs/reference/sql/aggregate-functions/groupformat)



This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See [SQL interface scope](/docs/reference/clickhouse-compatibility#service-interfaces).

Formats the rows in each group using the specified output format and returns the result as a string.

The format name is passed as a parameter, and the arguments are the columns to format.
Column names are generated as c1, c2, ... in the formatted output.

**Syntax**

```sql
groupFormat(format)(x, y, ...)
```

**Parameters**

* `format` — Output format name. For example, JSONEachRow, CSV, TabSeparated. [`String`](/reference/data-types/string)

**Arguments**

* `x, y, ...` — Expressions to format as rows. [`Any`](/reference/data-types)

**Returned value**

Formatted output for the group. [`String`](/reference/data-types/string)

**Examples**

**Basic usage**

```sql title=Query
SELECT groupFormat('JSONEachRow')(number, toString(number))
FROM numbers(3)
```

```text title=Response
{"c1":0,"c2":"0"}
{"c1":1,"c2":"1"}
{"c1":2,"c2":"2"}
```
