Edit Fields Node fails in JSON mode when "$&" in expression

#17336

Issue Details

about 2 months ago
No assignee
in linear
jimleukjimleuk
opened about 2 months ago
Author

Bug Description

When using the Set/Edit Fields node in JSON mode and an expression contains a string with the 2 characters "$&" together, the node fails to parse the JSON and gives the following error The 'JSON Output' in item 0 contains invalid JSON.

Good to know

  • Did a few checks and it seems to be working fine in expressions in general

To Reproduce

  1. Add "Edit Fields" node
  2. Switch to JSON mode
  3. Add expression which simply returns an object with a string property containing the characters "$&" together
  4. Execute node and the error should display

Expected behavior

As the JSON object is valid, there shouldn't be a JSON parse error.

Operating System

Linux, Mac

n8n Version

1.103.0 and 1.84.3

Node.js Version

???

Database

PostgreSQL

Execution mode

main (default)