question

MaheshMadhusanka-3900 avatar image
0 Votes"
MaheshMadhusanka-3900 asked MaheshMadhusanka-3900 commented

Logic app Experession error on JSON Containt

Hi Team

Currently we have requirement pick particular JSON attribute value to parse to Condition connector, However its not working as expected, For your reference here with attached sample condition and sample JSON attribute need to add to condition, could you please help to write correct expression for this value?

Required Value - : Code":"BVT",

Current Codition Expression - :

 string(body('Parse_JSON_2')?['properties']?['Body']?['properties']?['UniversalEvent']?['properties']?['Event']?['properties']?['DataContext']?['properties']?['ActionPurpose']?['properties']?['Code'])

Sourse JSON -:

 {
    "?xml":{
       "@version":"1.0",
       "@encoding":"utf-8"
    },
    "UniversalInterchange":{
       "@xmlns":"http://www.cargowise.com/Schemas/Universal/2011/11",
       "@version":"1.1",
       "Header":{
          "SenderID":"EXKUSAPRD",
          "RecipientID":"BravoTran"
       },
       "Body":{
          "UniversalEvent":{
             "@xmlns":"http://www.cse.com/Schemas/Universal/2011/11",
             "@version":"1.1",
             "Event":{
                "DataContext":{
                   "DataSourceCollection":{
                      "DataSource":{
                         "Type":"Forwament",
                         "Key":"S80"
                      }
                   },
                   "ActionPurpose":{
                      "Code":"BVT",
                      "Description":"BravoTran"
                   },
                   "Company":{


195928-image.png


azure-logic-apps
image.png (14.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KamleshKumar avatar image
0 Votes"
KamleshKumar answered MaheshMadhusanka-3900 commented

Hi There,

Thank you for asking this question on the Microsoft Q&A Platform.

I would suggest to use the below condition expression, also if you can try to get the data in compose step to check what is value populating, I have tried with given example and it's working fine for me with below expression.

 string(body('Parse_JSON_2')?['UniversalInterchange']?['Body']?['UniversalEvent']?['Event']?['DataContext']?['ActionPurpose']?['Code'])

196048-image.png
196047-image.png

Regards,
Kamlesh Kumar
BizTalk Techie

If this answer solved your problem, please click the Verify Answer button (found below the answer) to help other users who have the same question.



image.png (12.7 KiB)
image.png (19.7 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KamleshKumar and @MayankBargali-MSFT Thank you very much for your support its working.

1 Vote 1 ·