I am getting google analytics data and then I want to pass that data to openrouter.ai using an http request to analyze the data.
The issue is that when I pass the array of data to http request, I keep getting invalid JSON format.
This is the expression I am using inside my HTTP request.
{
"model": "meta-llama/llama-3.1-70b-instruct:free",
"messages": [
{
"role": "user",
"content": "{{ JSON.stringify($('Aggregate').item.json.data) }}"
}
]
}
The data looks like this:
}
],
"metricValues": [
{
"value": "6"
},
{
"value": "4"
},
{
"value": "1.5"
},
{
"value": "19"
}
]
I’ve tried to wrap the data using JSON.stringify() but it won’t work. I even tried to put in code to aggregate all the data but all the same issue.
For reference, I can do this much easier in make.com. Make combines all the values into text files automatically and then passes it to my http request.
Information on your n8n setup
- n8n version: 1.63.4
- Database (default: SQLite): PostgreSQP
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): docker
- Operating system: Google cloud