docs: remove outdated expressions documentation and update navigation (#4287)

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Kartik Balasubramanian
2026-02-26 10:40:36 +00:00
committed by GitHub
parent 8e128f4a81
commit 0a406f9030
9 changed files with 54 additions and 109 deletions

View File

@@ -128,7 +128,6 @@
/code-examples/javascript-functions/get-binary-data-buffer/ /code/cookbook/code-node/get-binary-data-buffer/ 301
/code-examples/javascript-functions/console-log/ /code/cookbook/code-node/console-log/ 301
/code-examples/ai-code/ /code/ai-code/ 301
/code-examples/expressions/check-incoming-data/ /code/cookbook/expressions/check-incoming-data/ 301
/code-examples/expressions/ /code/expressions/ 301
/code-examples/expressions/expressions/ /code/expressions/ 301
/code-examples/javascript-functions/ /code/code-node/ 301

View File

@@ -192,7 +192,6 @@
/code-examples/javascript-functions/get-binary-data-buffer/ /code/cookbook/code-node/get-binary-data-buffer/ 301
/code-examples/javascript-functions/console-log/ /code/cookbook/code-node/console-log/ 301
/code-examples/ai-code/ /code/ai-code/ 301
/code-examples/expressions/check-incoming-data/ /code/cookbook/expressions/check-incoming-data/ 301
/code-examples/expressions/ /code/expressions/ 301
/code-examples/expressions/expressions/ /code/expressions/ 301
/code-examples/javascript-functions/ /code/code-node/ 301

View File

@@ -1,22 +0,0 @@
---
contentType: howto
---
# Check incoming data
At times, you may want to check the incoming data. If the incoming data doesn't match a condition, you may want to return a different value. For example, you want to check if a variable from the previous node is empty and return a string if it's empty. Use the following code snippet to return `not found` if the variable is empty.
```javascript
{{$json["variable_name"]? $json["variable_name"] :"not found"}}
```
The above expression uses the ternary operator. You can learn more about the ternary operator [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator).
As an alternative, you can use the [nullish coalescing operator (??)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing) or the [logical or operator (||)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR):
```javascript
{{ $x ?? "default value" }}
{{ $x || "default value" }}
```
In either of the above two cases, the value of `$x` will be used if it's set to a non-null, non-false value. The string `default value` is the fallback value.

View File

@@ -1,59 +0,0 @@
---
title: Expressions common issues
description: Documentation for common issues and questions related to expressions in n8n, a workflow automation platform. Includes details of the issue and suggested solutions.
contentType: howto
---
# Expressions common issues
Here are some common errors and issues related to [expressions](/data/expressions.md) and steps to resolve or troubleshoot them.
## The 'JSON Output' in item 0 contains invalid JSON
This error occurs when you use JSON mode but don't provide a valid JSON object. Depending on the problem with the JSON object, the error sometimes display as `The 'JSON Output' in item 0 does not contain a valid JSON object`.
To resolve this, make sure that the code you provide is valid JSON:
- Check the JSON with a [JSON validator](https://jsonlint.com/).
- Check that your JSON object doesn't reference undefined input data. This may occur if the incoming data doesn't always include the same fields.
## Can't get data for expression
This error occurs when n8n can't retrieve the data referenced by an expression. Often, this happens when the preceding node hasn't been run yet.
Another variation of this may appear as `Referenced node is unexecuted`. In that case, the full text of this error will tell you the exact node that isn't executing in this format:
> An expression references the node '&lt;node-name&gt;', but it hasnt been executed yet. Either change the expression, or re-wire your workflow to make sure that node executes first.
>
To begin troubleshooting, test the workflow up to the named node.
For nodes that use JavaScript or other custom code, you can check if a previous node has executed before trying to use its value by checking the following:
```javascript
$("<node-name>").isExecuted
```
As an example, this JSON references the parameters of the input data. This error will display if you test this step without connecting it to another node:
```javascript
{
"my_field_1": {{ $input.params }}
}
```
## Invalid syntax
This error occurs when you use an expression that has a syntax error.
For example, the expression in this JSON includes a trailing period, which results in an invalid syntax error:
```jsx
{
"my_field_1": "value",
"my_field_2": {{ $('If').item.json. }}
}
```
To resolve this error, check your [expression syntax](/data/expressions.md) to make sure they follow the expected format.

View File

@@ -1,20 +0,0 @@
---
description: Code examples you can use in expressions.
contentType: overview
---
# Expressions cookbook
This section contains examples and recipes for tasks you can do with [expressions](/glossary.md#expression-n8n).
/// note | Python support
You can use Python in the Code node. It isn't available in expressions.
///
[[% import "_macros/section-toc.html" as sectionToc %]]
[[ sectionToc.sectionToc(page) ]]
## Related resources
* [Built-in methods and variables reference](/code/builtin/overview.md)
* [Expressions](/data/expressions.md)

View File

@@ -84,3 +84,55 @@ The following code use the Luxon date and time library to find the time between
return diffInMonths.toObject();
})()}}
```
## Common issues
Here are some common errors and issues related to [expressions](/data/expressions.md) and steps to resolve or troubleshoot them.
### The 'JSON Output' in item 0 contains invalid JSON
This error occurs when you use JSON mode but don't provide a valid JSON object. Depending on the problem with the JSON object, the error sometimes displays as `The 'JSON Output' in item 0 does not contain a valid JSON object`.
To resolve this, make sure that the code you provide is valid JSON:
- Check the JSON with a [JSON validator](https://jsonlint.com/).
- Check that your JSON object doesn't reference undefined input data. This may occur if the incoming data doesn't always include the same fields.
### Can't get data for expression
This error occurs when n8n can't retrieve the data referenced by an expression. Often, this happens when the preceding node hasn't been run yet.
Another variation of this may appear as `Referenced node is unexecuted`. In that case, the full text of this error will tell you the exact node that isn't executing in this format:
> An expression references the node '&lt;node-name&gt;', but it hasn't been executed yet. Either change the expression, or re-wire your workflow to make sure that node executes first.
To begin troubleshooting, test the workflow up to the named node.
For nodes that use JavaScript or other custom code, you can check if a previous node has executed before trying to use its value by checking the following:
```javascript
$("<node-name>").isExecuted
```
As an example, this JSON references the parameters of the input data. This error will display if you test this step without connecting it to another node:
```javascript
{
"my_field_1": {{ $input.params }}
}
```
### Invalid syntax
This error occurs when you use an expression that has a syntax error.
For example, the expression in this JSON includes a trailing period, which results in an invalid syntax error:
```jsx
{
"my_field_1": "value",
"my_field_2": {{ $('If').item.json. }}
}
```
To resolve this error, check your [expression syntax](/data/expressions.md) to make sure it follows the expected format.

View File

@@ -70,4 +70,4 @@ To work around this, check for the existence of the field data before sending it
To check for the data before executing the Notion node, use an [If](/integrations/builtin/core-nodes/n8n-nodes-base.if.md) node to check whether the field is unset. This allows you to use the [Edit Fields (Set)](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) node to conditionally remove the field when it doesn't have a valid value.
As an alternative, you can set a [default value](/code/cookbook/expressions/check-incoming-data.md) if the incoming data doesn't provide one.
As an alternative, you can set a default value if the incoming data doesn't provide one.

View File

@@ -15,7 +15,7 @@ This error occurs when WhatsApp Business Cloud rejects your request because of a
To resolve this issue, review the parameters in your [message template](https://www.facebook.com/business/help/2055875911147364?id=2129163877102343). Pay attention to each parameter's data type and the order they're defined in the template.
Check the data that n8n is mapping to the template parameters. If you're using expressions to set parameter values, check the input data to make sure each item resolves to a valid value. You may want to use the [Edit Fields (Set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) or [set a fallback value](/code/cookbook/expressions/check-incoming-data.md) to ensure you send a value with the correct format.
Check the data that n8n is mapping to the template parameters. If you're using expressions to set parameter values, check the input data to make sure each item resolves to a valid value. You may want to use the [Edit Fields (Set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) or set a fallback value to ensure you send a value with the correct format.
## Working with non-text media

View File

@@ -1314,10 +1314,6 @@ nav:
- getWorkflowStaticData: code/cookbook/builtin/get-workflow-static-data.md
- (node-name).all: code/cookbook/builtin/all.md
- vars: code/cookbook/builtin/vars.md
- Expressions:
- code/cookbook/expressions/index.md
- Check incoming data: code/cookbook/expressions/check-incoming-data.md
- Common issues: code/cookbook/expressions/common-issues.md
- Code node:
- code/cookbook/code-node/index.md
- Get number of items returned by last node: code/cookbook/code-node/number-items-last-node.md