Extract data from a json with a variable in the body

Hi, I don’t know if what I wrote in the subjet is the correct way to express my problem, but the thing is that an API sends the data I need inside something that is variable, let me show you:

What I need in my next node is the smtpStatus response, but since that comes nested inside the email, I don’t know how to call it from my IF node, because if I try this:

I’m leaving the email of my test hardcoded into the node, so the next email in the batch isn’t found.

I tired using regex in the expression, something like this:


But it didn’t work.

Then, from what I could understand from other posts in the forum, I have to flatten de json, but I couldn’t make it work.

I’m sorry if I don’t make any sense, I don’t know much about javascript or json name of things, I hope I was able to express my problem. I’ll try to clarify more if you need.

Thank you for your time.

Pablo T.

Welcome to the community @pablotll

What do you want to do with the smtp status exactly? do you want to check if it has a specific status using the IF node?

Yes, I want to use an IF node, if the Status is valid, send the email to a Mailchimp node, if the Status is anything else, send the status to Slack for me to review. Thank you.

Hey @pablotll,

If the structure of incoming data remains the same you can use this expression: {{$json[Object.keys($json)[1]]["data"]["smtpStatus"]}}

Hey @harshil1712 thank you for your time!

Your answer did the trick, my workflow is working like a charm.

Thank you very much.

1 Like