How to extract json string in text file?

Describe the problem/error/question

I have a text file that contains a json string located at the end of e file and I want to extract it. How can I do this? my workflow is giving me undefined error. Here’s the textfile for testing purpose https://pastebin.com/raw/W4bnsraa

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: 2.8.3
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Ubuntu 24.04 LTS

Hi @Ruriko
I reproduced your workflow on my machine and figured out exactly what’s going on. You are actually super close, but two tiny formatting details are tripping up the node.

If you look closely at your expression, you have an = sitting right before the {{ }} brackets. In n8n, starting an expression with = forces the output to become a plain text string that literally starts with an equals sign. That’s why your preview shows =[object Object] instead of real data. Just delete that = so your expression starts directly with the curly brackets.


Because your JSON block starts and ends with [ ] brackets, it’s technically a list of items (an Array), not a single Object or String. In your Edit Fields node, look right next to your data field name and change the type dropdown to Array.

Once you drop that equals sign and flip the dropdown to Array, it unpacks the JSON perfectly! Let me know if that gets it working on your end.

1 Like

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