-
-
Notifications
You must be signed in to change notification settings - Fork 24k
Description
Describe the bug
Each file contains some javascript code:
Which I am trying to use in the llm as an iterator value,
but the json cleaning causes removing of all escapes that results into error at JSON.parse() line, causing this error with iterator and bubbling up:
Proposed solution:
const safeParseJson = (str) => { try { return JSON.parse(str) } catch { // Try parsing after cleaning return JSON.parse(str.replace(/\\(["'[\]{}])/g, '$1')) } } const iterationInputArray = typeof iterationInput === 'string' && iterationInput !== '' ? safeParseJson(iterationInput) : iterationInput;
To Reproduce
Put a json array that contains stringified codes into iterate with iterator using custom javascript function
Expected behavior
Iterator should have parsed the json and given values to node inside
Screenshots
No response
Flow
Use Method
None
Flowise Version
v3.0.5
Operating System
Linux
Browser
Firefox
Additional context
No response