If you’ve ever used AI nodes in n8n, you might have noticed that the output data can be inconsistent across different runs. Today, I’ll show you how to standardize this output to meet your specific format requirements.
In this example, I input data directly through n8n chat. The input is processed by the AI to filter out even or odd numbers, and then returns the results. As you can see, the initial output can be messy and not in the desired format.

Below, you’ll see an example where the output has been formatted correctly according to the requirements.

Steps to Standardize the Output Format:
- Enable “Require Specific Output Format”:
- In the AI node, turn on this option.
- Select Structured Output Parser in the “Output Parsers” section.

2. Configure the Structured Output Parser Node:
- Define the structure you want for the output.

- For example, if you want to include the largest and smallest numbers alongside the even and odd numbers, modify the code as follows:
{
"sochan": "2, 4",
"sole": "1, 3",
"solonnhat":"100000",
"sonhonhat":"1"
}
3. Adjust the Input Prompt:
- Update the input prompt accordingly (refer to the image for an example).
- Once configured, the output will be generated in the format you require.

Result:
After setting up the Structured Output Parser and adjusting the input prompt, you’ll see the output aligns perfectly with your expectations.
By following these steps, you can ensure the AI node in n8n always returns results in the correct format.