Home > Mobile >  How to remove section in JSON after parsing a message in LogicApp
How to remove section in JSON after parsing a message in LogicApp

Time:11-07

Parsed Message { "date": "2022-02-04", "customerID": 123, "customerInfo": { "id": 123, "lastname": "Smith", "firstname": "David", "email": "[email protected]", }, "currency": "EUR" }

I would like to remove the customerInfo section so the JSON looks like. { "date": "2022-02-04", "customerID": 123, "currency": "EUR" }

How would one do this in the LogicApp. I tried remove property but could not get that working. Any suggestions would be appreciated.

CodePudding user response:

You just initialize new variable from that one and populate it

"Initialize_variable": {
      "type": "InitializeVariable",
      "inputs": {
         "variables": [ {
               "name": "sensitisedMessage",
               "type": "Object",
               "value":  { "date": @message['date'], "customerID": @message['customerID'], "currency": "@message['currency']" }
          } ]
      },
      "runAfter": {}
   }

I have not checked the format of the json in an actual logic app, but you get the idea

CodePudding user response:

I have reproduced in my environment and removed customer info using remove property as below :

Firstly, I have initialized a variable as below:

enter image description here

Then I used compose operation as below: In compose input: removeProperty(variables('emo'),'customerInfo') enter image description here

Then i have set the variable with output of compose as below: enter image description here

Output:

enter image description here

enter image description here

enter image description here

enter image description here

Try to follow above process you will get to remove customerInfo as mine got.

  • Related