> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/code-examples/expressions.md).

# Expression examples in Duaer

These Duaer examples run in expression mode. They read the current item, fill a default, format a date, and move a large reshape into Edit Fields (Set).
## Read one field from a webhook body

When the trigger puts the incoming JSON on body, the next node reads the city like this:

```
{{ $json.body.city }}
```

## Supply a default when the value is missing

$ifEmpty replaces undefined, null, an empty string, an empty array, and an empty object with the second argument.

```
{{ $ifEmpty($json.body.city, "unknown") }}
```

## Format the current time

```
{{ $now.setZone("Asia/Shanghai").toFormat("yyyy-MM-dd HH:mm") }}
```

## Prepare many fields in one place

When several fields change together, add an Edit Fields (Set) node and put one expression on each new field. Later nodes read the prepared $json instead of repeating the same path.
## Questions

### How do you read a city from a webhook body in Duaer?

In Duaer, in the next node, write {{ $json.body.city }}. When the city may be missing, use {{ $ifEmpty($json.body.city, "unknown") }}.

### Where should Duaer expressions go when many fields change?

In a Duaer workflow, add an Edit Fields (Set) node and put one expression on each new field. Later nodes read the prepared $json—do not repeat the same path in every parameter.

## Related

- [Transform data with expressions in Duaer](https://doc.duaer.com/code/expressions.md)
- [Use convenience methods in Duaer expressions](https://doc.duaer.com/code/builtin/convenience.md)
- [Work with dates using Luxon in Duaer](https://doc.duaer.com/code/cookbook/luxon.md)

