I’ve scoured the forums for a solution to this and whilst I see lots of topics in relation to JSON, I can’t seem to find a solution that works for me - and I’m sure this should be straight forward with a regex type solution.
The JSON I need to extract the value from always follows the same structure:
{“ZbBind”:{“Device”:“0x1035”,“Status”:0,“StatusMessage”:“SUCCESS”}}
The only value I need to extract is the Device value, so 0X1035 in the above example.
Thanks all
Information on your n8n setup
Version 0.204.0
Self hosted on Digital Ocean Docker
Hi @mbuk, it looks in your example you aren’t working with a JSON object but a string inside a propertyName field. For @Niklas_Hatje’s logic to work you’d first need to parse this string. You can use JSON.parse() for the job.
I’ve updated your example workflow to show the idea:
That’s great - thank you. Your solution worked, however when I tried to replicate it in my own workflow, the final set module couldn’t find a value from the previous input.
It wasn’t until a bit of trial and error that I noticed when pasting the JSON into the set module, my version was using a different quotation character: