Error when dragging over fields - Problem in node ‘HTTP Request‘ JSON parameter needs to be valid JSON

Describe the problem/error/question

when I drag over my “text” field from the prior schema it breaks my work flow “problem in node “http request’ json parameter needs to be valid Json: Here is the Json request:

{
“model”: “wan/2-5-text-to-video”,
“callBackUrl”: “https://your-domain.com/api/callback”,
“input”: {
“prompt”: {{$json.content.parts[0].text}}, (this is where it breaks)
“duration”: “10”,
“aspect_ratio”: “16:9”,
“resolution”: “720p”,
“enable_prompt_expansion”: true
}
}

What is the error message (if any)?

Problem in node ‘HTTP Request‘

JSON parameter needs to be valid JSON

when I expand the prompt it shows the proper data but, when I execute it doesn’t work right. I did a test with just plain text and the api is all connected right. Please help thanks Geremy.

Hey @Geremy_D !

I think you have to use quotes “ around the expression.

“prompt”: “{{$json.content.parts[0].text}}”,

Cheers!

1 Like

I had quotes and it still didn’t work.

Hey @Geremy_D,
I can see the error that intended request, input must be an object, not an array

please use this :

{
“model”: “wan/2-5-text-to-video”,
“callBackUrl”: “``https://your-domain.com/api/callback”``,
“input”: {
“prompt”: “={{ $json.content.parts[0].text }}”,
“duration”: “10”,
“aspect_ratio”: “16:9”,
“resolution”: “720p”,
“enable_prompt_expansion”: true
}
}

and let me know if this works for you.

it did not

Hey, use JSON.stringify() or the .toJsonString() method in your expressions.

I see in your text that there are quotes “ characters, and it will break down the json.

1 Like

what would that look like exactly in the code sorry I’m not very technical. Thanks. Geremy

“prompt”: {{ JSON.stringify($json.content.parts[0].text) }}

Or

“prompt”: {{ $json.content.parts[0].text.toJsonString() }}

OR replace quotes chars in the string…

“prompt”: {{ JSON.stringify($json.content.parts[0].text.replace(/"/g, “'”)) }}

hmm this did not work = “prompt”: {{ JSON.stringify($json.content.parts[0].text) }}

and this one is saying bad syntex…

{
  "model": "wan/2-5-text-to-video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": {{ JSON.stringify($json.content.parts[0].text) }},
    "duration": "10",
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "enable_prompt_expansion": true
  }
}
2 Likes

your the man! thank you sir this worked

1 Like

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