Describe the problem/error/question
Hello. I am attempting to create a configuration module for a AI agentic workflow. The configuration node loads data from a filesystem and presents it as a JSON. The JSON elements make reference to other data in the workflow. A user would submit a query from a web page in the production system.
Part of user query from web page:
[
{
“query”: “What is the definition of recursive?”,
…..
}
]
Part of Configuration:
[
{
“QueryValidationAgent”: “{\n “contents”: [{\n “parts”: [{\n “text”: “{{ $json.body?.query || $json.query }}”\n }]\n }],\n “generationConfig”: {\n “response_mime_type”: “application/json”,\n “response_schema”: {\n “type”: “OBJECT”,\n “properties”: {\n “cleaned_context”: { “type”: “STRING”, “description”: “Extract the core query first.” },\n “reasoning”: { “type”: “STRING”, “description”: “Analyze if the context is sufficient.” },\n “image_request_detected”: { “type”: “BOOLEAN” },\n “status”: { “type”: “STRING”, “enum”: [“VALID_PROBLEM”, “MISSING_CONTEXT”, “INVALID”] }\n },\n “required”: [“cleaned_context”, “reasoning”, “image_request_detected”, “status”]\n }\n },\n “systemInstruction”: {\n “parts”: [{ “text”: “…” }]\n }\n}\n”
}
]
What is the error message (if any)?
I try to use the QueryValidationAgent JSON as the JSON body in a node like Edit Fields or an HTTP Request node as:
{{ $(‘Load Configuration’).item.json.ProblemValidationAgent }}
This loads the JSON fine. As can be seen above, the JSON contains a reference to the user query:
“text”: “{{ $json.body?.query || $json.query }}”
This JSON works if it is put raw into the JSON body of the node, filling in the query before passing along the output. But as a reference to Load Configuration, the query is undefined and left blank. Essentially, the JSON needs to be parsed before being passed on to the next node or the HTTP Request.
Please share your workflow
Share the output returned by the last node
Input:
{
“contents”: [{
“parts”: [{
“text”: “{{ $json.body?.query || $json.query }}”
}]
}],
…
}
Output:{
“contents”: [{
“parts”: [{
“text”: “”
}]
}],
…
}
Expected:
{
“contents”: [{
“parts”: [{
“text”: “What is the definition of recursive?”
}]
}],
…
}
How do I reference another JSON from a JSON used as a parameter to the JSON Body of a node?
Information on your n8n setup
- n8n version: current cloud version
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
- Operating system: