Dot notation

Learn how to access properties using dot notation.

This is the simplest and most concise way to access properties.

It follows the same syntax as some programming languages, such as JavaScript and Python. As a result, it may be more familiar to developers than to those who are not involved in programming.

The syntax consists of the variable name followed by a dot (.) and the property name.

Here is a basic example that accesses the interests property of the user variable:

user.interests
Try in Playground

You can also chain multiple property accesses together to access nested properties:

user.address.city
Try in Playground

Or even combine them with other notations, such as the bracket notation:

user.interests[0]
Try in Playground

Each notation has its own advantages and tradeoffs, so you should choose the one that best fits your scenario.

Consider using the dot notation when:

  • The property name is a valid identifier and is known in advance.
  • You are accessing a deeply nested property.
  • Anyone reading the queries is familiar with this notation.