Missing brackets in JSON

Describe the problem/error/question

When I put JSON expression between braces, closed bracket disappear.
I think it’s bug. is it normal or do I missed something?

What is the error message (if any)?

Previous Node Json output data


Working well

Not working (add brace and then missing closed braket)

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud **
  • Operating system: windows, chrome

Hi @David_Taewon_Hwang, welcome to the community :tada:

I am sorry you’re having trouble. When mixing JS content (inside your double curly brackets {{ }}) and non-JS content (outside these double brackets) n8n would try to concatenate a string. This might look odd in the builder (which renders your data using the browses’ JS engine), but you should still get the correct result when executing the node (in which case the rendering takes place on the actual n8n server).

That said, it’s probably not what you want as auto-converting an object like in your example to a string will result in the infamous [object Object] output so many JS users have come across (or rather { [object Object] } for your expression specifically).

Instead you probably want to use something like JSON.stringify() to build your proper string and mix it with additional brackets (or any other characters really) surrounding it. Something like { {{ JSON.stringify($json["data"]) }} } for your specific expression. Check out this example workflow:

This will return the incoming data structure (including all closing brackets) in a string surrounded by single curly brackets:

Hope this helps :slight_smile: