skip to Main Content
[
  {
    "@odata.etag": "",
    "ItemInternalId": "bf73ba98-d392-424c-9dc1-f2be44e9d431",
    "Name": "Shuvendu",
    "Dept": "Developer"
  },
  {
    "@odata.etag": "",
    "ItemInternalId": "3de1725d-d7cb-45fa-9855-713bbf8fdc23",
    "Name": "Debashish",
    "Dept": "DBA"
  }
]

This is my request body i want ro ignore "@odata.etag" and
"ItemInternalId" from the next operation in logic app I mean to say whatever the field like "Name","Dept" like this these field will be increase dynamically whatever the new field added those are needed but i want to ignore above those field

body('List_rows_present_in_a_table')?['value'] this is the body above arrey is the body element
expecting output

[
  {
    "Name": "Shuvendu",
    "Dept": "Developer"
  },
  {
    "Name": "Debashish",
    "Dept": "DBA"
  }
]

my main intention to remove those field dynamically so whatever the input body that contain "@odata.etag" and "ItemInternalId" thesse should be removed and display rest as output
i want this functionality in azure logic apps

body('List_rows_present_in_a_table')?['value'] this is the body from the above action enter image description here

[
  {
    "Name": "Shuvendu",
    "Dept": "Developer"
  },
  {
    "Name": "Debashish",
    "Dept": "DBA"
  }
]

expecting this output

3

Answers


  1. I have achieved your requirement in the following way-

    enter image description here

    Schema:

    {
    "items": {
    "properties": {
    "@@odata.etag": {
    "type": "string"
    },
    "Dept": {
    "type": "string"
    },
    "ItemInternalId": {
    "type": "string"
    },
    "Name": {
    "type": "string"
    }
    },
    "required": [
    "@@odata.etag",
    "ItemInternalId",
    "Name",
    "Dept"
    ],
    "type": "object"
    },
    "type": "array"
    }
    

    enter image description here

    Getting the output as below-

    enter image description here
    enter image description here
    enter image description here

    You need to Parse_JSON before performing Compose action in order to get the individual property value from a json.

    Login or Signup to reply.
  2. Try using removeProperty expression

    removeProperty(json('{ "firstName": "Sophia", "middleName": "Anne", "surName": "Owen" }'), 'middleName')
    

    original json:

    {
       "firstName": "Sophia",
       "middleName": "Anne",
       "surName": "Owen"
    }
    

    updated json:

    {
       "firstName": "Sophia",
       "surName": "Owen"
    }
    

    more info and examples here:

    https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#removeProperty

    Login or Signup to reply.
  3. You could do it a couple of other ways if you’re interested. One of which is the Select operation.

    Select

    Using a Select operation from the set of Data Operations actions, you can pick out what you want from the entire array without needing to add all of the operations for looping.

    Flow

    Flow

    Step Definition

    {
        "inputs": {
            "from": "@variables('Data')",
            "select": {
                "Dept": "@item()?['Dept']",
                "Name": "@item()?['Name']"
            }
        }
    }
    

    Result

    Result

    Depending on how dynamic your JSON could be, this may not be the best option because if a new field comes in, it will need to be mapped.

    If you wanted to take it a step further, the Advanced Data Operations connector will do it for you without looping and dynamically selecting the relevant fields. The structure could change and the logic will make sure the new fields are included.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search