Xano Documentation
Search…
Dot Notation
Dot notation allows you to access specific fields or data nested within a variable. Dot notation is a general programming concept and it is also a useful tool in Xano. You can apply dot notation on any input/value line within the Function Stack or Response - whether that be within Functions or Filters. Watch the tutorial to understand important rules and concepts around dot notation in Xano.
​

Using dot notation

Dot notation must be used on an existing variable in Xano.
Let's use the variable car as an example. Below you can see that 'car' is data retrieved from a database table with a Get Record function. The response shows us the contents of the variable - all the fields and data.
The variable car being returned in our response.
Let's say we want to retrieve just the make of the car variable. For this we can use dot notation to do so.
**It's very important to make sure the data type, as signified on the top of the input/value line is var: any (this signifies we have a variable data type selected).**
Once the variable is selected, add a '.' after the variable name and type out the field name of the data you wish to retrieve. **Spelling must be an exact match**
In this new variable, we are using dot notation on the 'car' variable to retrieve the 'make' of the car by writing 'car.make'
If we return the new variable make of car we will return the value of car.make, which is "toyota."
'car.make' = toyota

Using dot notation with Lists (Arrays)

Using the same example from above, let's say we have a Query all records function that queries all records from the car database table and returns an array of 3 cars stored in the variable car. It will return a large payload that looks something like below:
1
[
2
{
3
"id":4,
4
"created_at":1632268901955,
5
"make":"honda",
6
"model":"civic",
7
"year":2002,
8
"maintenance":[
9
{
10
"year":2004,
11
"description":"New bumper"
12
},
13
{
14
"year":2009,
15
"description":"Radiator"
16
}
17
]
18
},
19
{
20
"id":1,
21
"created_at":1632268899571,
22
"make":"toyota",
23
"model":"corolla",
24
"year":1998,
25
"maintenance":[
26
{
27
"year":2015,
28
"description":"New enginge"
29
},
30
{
31
"year":2008,
32
"description":"Transmission"
33
}
34
]
35
},
36
{
37
"id":2,
38
"created_at":1632268900442,
39
"make":"jeep",
40
"model":"wrangler",
41
"year":2007,
42
"maintenance":[
43
{
44
"year":2016,
45
"description":"Suspension"
46
}
47
]
48
},
49
{
50
"id":3,
51
"created_at":1632268901252,
52
"make":"ford",
53
"model":"4 runner",
54
"year":2004,
55
"maintenance":[
56
{
57
"year":2011,
58
"description":"Windshield"
59
},
60
{
61
"year":2013,
62
"description":"Passenger door"
63
}
64
]
65
}
66
]
Copied!
Now if we only wanted to return a list of car makes without all the extra bloat, traditionally you would have to do a for each loop function and store each car name in an array in its own variable. Luckily, using Xano's Dot Notation engine, you can easily get the makes of the cars.
We can create a variable and specify car.make which will return an array of just the car makes:
`car.make` = ["honda","toyota","jeep","ford"]
Now when you return the variable just_the_makes It will return an array that looks like this:
1
"`car.make`""="[
2
"honda",
3
"toyota",
4
"jeep",
5
"ford"
6
]
Copied!

GET filter

The GET filter allows you to return the value of an object at a specified path. In other words, it's another way to use dot notation but with a filter.
You can think of the GET filter like replacing a . in dot notation. For example, to retrieve the make of a car instead of car.make - you could apply the GET filter to say car|GET|make
The GET filter is applied to get the value of the specified path 'make' from the 'car' object/variable.

Why use the GET filter?

The GET filter has a unique advantage that can be very useful for certain use cases. It allows you to define a default value in case the specified path does not exist.
Use cases where this may come in handy would be when calling an external API or receiving a Webhook and the returned payload can differ. Possibly you are working with a field that is sometimes present and sometimes not. Defining a default value with the GET filter allows your function stack to continue to run and complete the logic you are performing. You can also use conditional logic based on a default value to perform certain logic if the specified field does not exist.
The GET filter allows for flexible default values.
Last modified 27d ago