Preview is not giving a closing bracket

hello, i am having this issue on n8n where i am trying to pass the option name and value of the variants via http request node through Shopify API.

For some reason, its not respecting the closing bracket, please see screenshot for more details.

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:

any support team that can help me figure this out?

This is most likely related to how n8n internally evaluates expressions and converts strings to JSON. The most reliable way to get around it is to make the entire thing an expression (which means you’re using js object syntax instead of dealing with quotes, etc. in JSON syntax), and then convert it yourself at the end using .toJsonString()… like this:

{{
   {
      someAttribute: "some value",
      someFieldWithVariableContent: "The firstpart of the content " + ${'othernode'}.item.json.someAttribName + " and the last part"
   }.toJsonString()
}}

In the preview, you’ll see how this fixes up all the quoting, array syntax, etc. and gives you valid JSON output.

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