Can not put back slash in single line in Reading File node

Describe the problem/error/question

In the Read File Node I’m trying to put a backslash after the expression in the file path but it’s making a new line. How can I make it as a single line?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

I’m sure the line break is coming from the {{ $json.dirs }} expression.
If you can’t fix it in your input, you can replace them in the expression like this:

{{ $json.dirs.replace(/\r?\n|\r/g, "") }}

Info on RegEx replace here.

If you just care about whitespace and line breaks at the beginning and end of a string:

{{ $json.dirs.trim() }}
1 Like

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