You are viewing limited content. For full access, please sign in.

Question

Question

Parsing Web Request with JSONPath

asked on November 5

I have a Web Request that reads an email inbox and returns a list of email data.

I want to iterate over these to pull data from them (and possibly trigger further Web Requests on the individual emails) with a workflow, and it seems like it will be easier to gather the identifying values using JSONPath to pass output values than to parse the whole block in the workflow.

My body is structured like so, with a variable number of emails in the values array.

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('user%40example.com')/mailFolders('Inbox')/messages(id,subject,from,receivedDateTime,hasAttachments,bodyPreview)",
  "value": [
    {
      "@odata.etag": "ETAG_PLACEHOLDER_1",
      "id": "EMAIL_ID_PLACEHOLDER_1",
      "receivedDateTime": "2025-10-27T15:43:31Z",
      "hasAttachments": false,
      "subject": "subject1",
      "bodyPreview": "body1",
      "from": {
        "emailAddress": {
          "name": "User One",
          "address": "user1@example.com"
        }
      }
    },
    {
      "@odata.etag": "ETAG_PLACEHOLDER_2",
      "id": "EMAIL_ID_PLACEHOLDER_2",
      "receivedDateTime": "2025-10-27T17:53:15Z",
      "hasAttachments": true,
      "subject": "subject2",
      "bodyPreview": "body2.",
      "from": {
        "emailAddress": {
          "name": "User Two",
          "address": "user2@example.com"
        }
      }
    },
    {
      "@odata.etag": "ETAG_PLACEHOLDER_3",
      "id": "EMAIL_ID_PLACEHOLDER_3",
      "receivedDateTime": "2025-10-27T18:26:19Z",
      "hasAttachments": false,
      "subject": "subject3",
      "bodyPreview": "body3",
      "from": {
        "emailAddress": {
          "name": "User Three",
          "address": "user3@example.com"
        }
      }
    }
  ]
}

To parse this for my workflow, I am attempting to retrieve tokens with the ids, receivedDateTimes, hasAttachments, and addresses.

According to an online JSONPath evaluator, the expression "$.value[*].id" should give me 

[
  "EMAIL_ID_PLACEHOLDER_1",
  "EMAIL_ID_PLACEHOLDER_2",
  "EMAIL_ID_PLACEHOLDER_3"
]

but instead it returns only "EMAIL_ID_PLACEHOLDER_1".  Expressions I have tried for the other properties work the same, only returning the first result.

 

Am I missing something here?  Is there a better way to handle this?

0 0

Replies

replied on November 6

In your Read JSON activity, did you set it to return All matches as a multi-value token?

1 0
replied on November 6

I'm on Cloud, which does not appear to have a Read JSON activity for workflows.  I'm using the output tokens from the Web Request Rule itself.

 

Allegedly this is the equivalent, from the docs: "Read JSON" functionality is available natively in the "Run Web Request Rule" activity on SaaS."

0 0
replied on November 12 Show version history

This is a display issue in the web request rule UI. The parameter returned to Workflow will be a multi-value parameter with all 3 values. 
We'll fix this UI. Reference ID #624928.

3 0
replied on November 6

I completely missed that you had tagged it as Cloud.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.