skip to Main Content

i have a logic app in azure. i’m currently stuck in initialize expression variable after parse json. i want to catch "appId" parameter but all i get is null despite the fact that parse json giving an outout, so it seems that i I’m not expressing the right syntax.

this is my JSON output in parse JSON step

{
    "body": {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#servicePrincipals",
        "value": [
            {
                "id": "*************",
                "deletedDateTime": null,
                "accountEnabled": true,
                "alternativeNames": [],
                "appDisplayName": "testappp",
                "appDescription": null,
                "appId": "****************",
                "applicationTemplateId": null,
                "appOwnerOrganizationId": "***********",
                "appRoleAssignmentRequired": false,

i tried using that syntax –>
first(outputs(‘Parse_JSON’)?[‘body/value’])[‘appId’] and many many more 🙂

I’m using "first" coz there is a few appId instances in the output so i want to catch the first part. (don’t know if it’s the right way)

2

Answers


  1. You have to initialize variables at the start of your flow. You can Set Variable to update the value at any point during the flow. Logic apps should be showing you an error indicating that if you have added an init midway through.

    Login or Signup to reply.
  2. To get the first appId, instead of first(outputs('Parse_JSON')?['body/value'])['appId'] you should use this:

    body('Parse_JSON')?['body']?['value']?[0]?['appId']
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search