Hey, I tried to call the Gemini 2.5 flash image model via HTTP request, but I’m getting this error that I can’t seem to resolve in the JSON code. I feel like I’m doing it right, and ChatGPT doesn’t see any errors either. If anyone knows how to fix it, I’m all ears
I also tried to use the “stringify” function in the code directly and in an external code node to change the format, but it’s not working either.
Change your "{{ $json.prompt}}"
to "{{ $json.prompt.toJsonString() }}"
Without toJsonString(), the raw value may break JSON parsing (especially if it contains quotes, line breaks, or special characters).
Using .toJsonString() makes sure the value is escaped properly and produces valid JSON.
Otherwise you can use JSON.stringify() function, but you can use the .toJsonString() method also.
Use this, your JSON is wrong, since array cannot use key-value for that.
You need add one more object {} the curly branches which handle the text field