Azure Logic Apps: Remove "['contentData']" Object From JSON Iteration

Holomew 26 Reputation points
2022-03-28T15:11:03.25+00:00

I am sending a JSON message from Service Bus into Logic Apps.

I need to iterate with a For Each in Logic Apps but it is adding a contentData object.

JSON:

{
  "test": "1234"
}

Logic Apps is making it:

{
  "contentData": {
    "test": "1234"
  }
}
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,996 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,016 Reputation points
    2022-03-29T14:09:34.643+00:00

    @Holomew Thanks for reaching out. Can you please confirm if you are using service bus trigger and iterating the output inside for each loop?
    If this is the scenario then you can use the dynamic output Content on the current item and the result should only return your actual message content.

    187968-image.png

    Logic app does support different JSON & XML Manipulation function which you can leverage to perform different operations. In your case if you want to only get the contentData object then you can leverage the parse json action which will create the user-friendly fields or tokens for those properties by using the Parse JSON action. Now you can leverage these tokens in any of the next actions in your workflow to get the value of contentData token created by Parse Json action.

    Logic app already provide the dynamic objects so you can always leverage the dynamic object return by any action. In case if your requirement is not fulfilled using dynamic output then you can always leverage other actions/functions for your desired output.

    0 comments No comments