JSON parameter problem

Hello, I have a problem with using HTTP Request JSON parameter.
This is my JSON:
{
“messages”: [
{
“role”: “user”,
“content”: {{ $fromAI(“rag-question”) }}
}
],
“stream”: false,
“model”: “gpt-4o”
}
Returns me a green light and the correct content, but still shows me “JSON parameter needs to be valid JSON” when I tried to execute it.

Can someone help me fix it? I’m using JSON from Pinecone.

Hi @Zdravko_Dimitrov , you need to wrap the value you’re inserting in double quotes so that the result becomes a valid JSON.

The line should look like this “content”: "{{ $fromAI(“rag-question”) }}"

For more complex values like arrays or nested json it’s also conveninet to use “content”: {{ JSON.stringify($myValue) }} which is going to automatically wrap the value in quotes and escape any characters inside if needed.

2 Likes

Hmm, I tried, but it still gives me the same error.

Can you share your workflow so that I can give it a try?

Fixed it. The parameter rag-question was the problem. Thank you Svetlio. :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.