I’m having trouble converting a STRING into JSON to use in the HTTP Module.
Using the SET Module, I created the variables that I will use within the HTTP Module.
Among them, I built the CODE Module to make the JSON.PARSE of the variables present within the SET module, but the conversion does not work.
Could you support me?
Please share your workflow
My desired output is that the STRING I could insert inside the HTTP Module in JSON Format.
I´m using the Online Version of N8N.
n8n
2
It looks like your topic is missing some important information. Could you provide the following if applicable.
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system:
barn4k
3
hello @lffelgueiras
You can’t parse that string into JSON because it is not a valid JSON.
Instead, you should use {{JSON.stringify($json.User_Perfil_Comportamental)}}
in the content section of the HTTP Node and remove the Code node
payload for the HTTP node will look like this:
{
"model": "mistral-medium",
"messages": [
{
"role": "system",
"content": "{{JSON.stringify($json.User_Perfil_Comportamental)}}"
},
{
"role": "user",
"content": {{197.json}}
}
],
"temperature": 0.8,
"top_p": 1,
"max_tokens": 32000,
"stream": false,
"safe_prompt": false,
"random_seed": null
}
2 Likes
system
Closed
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.