Skip to main content
Version: 2024.4

Using Aliases

Aliases are used to rename the result of a field. This is useful when you want to return multiple fields with the same name.

There are two ways to use aliases:

Alias Operator

See Alias operator for more information.

Alias in the Query

Get a Car with id 82 and return the number of doors. The first value is the alias, the second value is the field name.

Request

{
getCar(id: 82) {
doors: numberOfDoors
}
}

Response

{
"data": {
"getCar": {
"doors": 2
}
}
}