Error using placeholders in HTTP Request Tool

I am receiving an error when using the HTTP Request Tool when trying to include placeholders inside a JSON body.

Describe the problem/error/question

I am using the HTTP Request Tool have have the following fields populated:
Method: POST
Send Header ON with content-type specified as application/json
Send Body ON
Specify Body: Using JSON Below
JSON (Fixed):

{
  "q": "site:linkedin.com {title} {domain}"
}

Placeholders including relevant descriptions: domain, title

I wouldn’t expect the placeholders included this way to interfere with JSON parsing since they are curly braces inside a string literal but it appears they are. I have tried using the expression mode instead and using {{ $json.title }} but it only iterates on the 1 row from the google sheet when done this way instead of iterating on each row. Should I be wrapping this in a Loop node?

What is the error message (if any)?

Could not replace placeholders in body: Expected ‘,’ or ‘}’ after property value in JSON at position 29

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

Debug info

core

  • n8nVersion: 1.88.0
  • platform: docker (self-hosted)
  • nodeJsVersion: 20.19.0
  • database: sqlite
  • executionMode: regular
  • concurrency: -1
  • license: enterprise (production)

Hi @brendan6 Welcome to n8n :n8n: community :tada:

You don’t need to specify the Type for the placeholder, It should work just like this:


If this solves your issue, feel free to mark the reply as the solution :white_check_mark::pray:t2:

1 Like

This worked!! Thank you.

I didn’t think that would be the issue. How is Type supposed to work?

1 Like

I’m not exactly sure what happens under the hood, but my guess is that when you specify a type, it becomes mandatory, and the final JSON might end up looking something like this:

{
  "q": "site:linkedin.com "title" "domain""
}

Which, of course, isn’t valid JSON

So without a type, the placeholder likely just stays as {title} and {domain} without any extra quotes added…

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