Error body extract message from error

Hey see screenshot. How can I only show the message and not the the message with the other “code”?

This pops up if “rusult returns an error” and this text is in the error body.

What it shows:
“{"message":"The following Extra quantities now greater than availability: Tee Shirt","payload":""}”

What I want it to show:
The following Extra quantities now greater than availability: Tee Shirt

Thanks!

This text is escaped JSON, which means you’ll have to either parse it as JSON and then get the value of the ‘message’ key - or you can simply manipulate this text by getting rid of the unwanted text and retaining the contents of the message.

I’d go with option 2 if this format isn’t going to change.
I’d use the :split by operator on this text twice:
first, split by "message\":\" and on item#2, split it by \",\"payload\" and take the first item. This will be your message’s content.

Hi Ranjit, thanks for helping me out! That mostly worked. I’m having one issue: I now have a comma at the end of my text. Do you know why that may be?

Here is the popup and how I have it set up:
Screen Shot 2023-05-23 at 4.34.56 PM


add :first item just after the second split operation

That worked. Thanks Ranjit!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.