# How to parse and filter JSON String in Sailpoint Workflows?

**URL:** <https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, sailpoint-identity-security\
**Created:** [October 28, 2024, 3:28pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193 "2024-10-28T15:28:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blazelip](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/blazelip/32/17177_2.png) [@Blazelip](https://developer.sailpoint.com/discuss/u/Blazelip)\
**Post date:** [October 28, 2024, 3:28pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/1 "2024-10-28T15:28:48Z")

</div>

Hi everyone,

I’m working with a Workflow in SailPoint where I’ve set up a trigger to fire on identity attribute change. My goal is to parse an attribute **newValue** that contains a complex JSON string representing various events related to a user’s profile.

Here’s an example of the JSON structure I’m dealing with:  
{ “Actions”: [{ “ActionTypeCode” : “02”, “ActionTypeName”: “Organizational Change”, “ReasonCode” : “01”, “ReasonTypeText”: “Transfer without change of pay”, “ActionStartDate” : “2022-09-01”, “ActionEndDate” : “9999-12-31”, “EmployeeNumber” : “01000014” } ,{ “ActionTypeCode” : “90”, “ActionTypeName”: “Migration”, “ReasonCode” : “”, “ReasonTypeText”: “”, “ActionStartDate” : “2018-04-01”, “ActionEndDate” : “2022-08-31”, “EmployeeNumber” : “01000014” }] }

In the beautified view:

```auto
{
  "Actions": [
    {
      "ActionTypeCode": "02",
      "ActionTypeName": "Organizational Change",
      "ReasonCode": "01",
      "ReasonTypeText": "Transfer without change of pay",
      "ActionStartDate": "2022-09-01",
      "ActionEndDate": "9999-12-31",
      "EmployeeNumber": "01000014"
    },
    {
      "ActionTypeCode": "90",
      "ActionTypeName": "Migration",
      "ReasonCode": "",
      "ReasonTypeText": "",
      "ActionStartDate": "2018-04-01",
      "ActionEndDate": "2022-08-31",
      "EmployeeNumber": "01000014"
    }
  ]
}

```

The challenge is that SailPoint treats this entire JSON data as a string stored in the identity attribute, which makes it difficult to perform complex parsing and filtering.

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/7/c/7ccadf042b62aceef8b134f53c6da20c86d9a320.png)

For example, I need to extract the ActionStartDate of specific events based on criteria like ActionTypeCode and compare these dates with the current date to determine further actions (e.g., sending emails to the responsible manager).

Any guidance or examples on how to achieve this would be greatly appreciated. Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![officialamitguptaa](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/officialamitguptaa/32/6624_2.png) [@officialamitguptaa](https://developer.sailpoint.com/discuss/u/officialamitguptaa)\
**Post date:** [October 28, 2024, 3:45pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/2 "2024-10-28T15:45:29Z")

</div>

@Blazelip - Below is the escaped JSON for your reference

```auto
{\r\n \"Actions\": [\r\n {\r\n \"ActionTypeCode\": \"02\",\r\n \"ActionTypeName\": \"Organizational Change\",\r\n \"ReasonCode\": \"01\",\r\n \"ReasonTypeText\": \"Transfer without change of pay\",\r\n \"ActionStartDate\": \"2022-09-01\",\r\n \"ActionEndDate\": \"9999-12-31\",\r\n \"EmployeeNumber\": \"01000014\"\r\n },\r\n {\r\n \"ActionTypeCode\": \"90\",\r\n \"ActionTypeName\": \"Migration\",\r\n \"ReasonCode\": \"\",\r\n \"ReasonTypeText\": \"\",\r\n \"ActionStartDate\": \"2018-04-01\",\r\n \"ActionEndDate\": \"2022-08-31\",\r\n \"EmployeeNumber\": \"01000014\"\r\n }\r\n]\r\n}

```

You can use below website for your JSON escape and unescape purpose -

> **[Free Online JSON Escape / Unescape Tool - FreeFormatter.com](https://www.freeformatter.com/json-escape.html)**
>
> A free online tool to escape or unescape JSON strings

Thank you

---

<div class="post-metadata">

**Author:** ![Blazelip](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/blazelip/32/17177_2.png) [@Blazelip](https://developer.sailpoint.com/discuss/u/Blazelip)\
**Post date:** [October 28, 2024, 3:55pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/3 "2024-10-28T15:55:36Z")

</div>

Thank u for such a quick reply @officialamitguptaa ,

As far as I understood doing JSON escape string that lets us to use this as Worklow Testing Input. But how I can parse it afterwards? Since it’s still a string and as I said I need a complex parsing of it (item filtering, etc)

Now we test the workflow with mock data.  
Btw, will the auto escape-string come into game during the real “game”?

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/5/7/57845c168a5ccc275e33620d116930981faa1d29.png)

---

<div class="post-metadata">

**Author:** ![jesvin90](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jesvin90/32/5301_2.png) [@jesvin90](https://developer.sailpoint.com/discuss/u/jesvin90)\
**Post date:** [October 28, 2024, 3:58pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/4 "2024-10-28T15:58:49Z")

</div>

Hi @Blazelip,

Have you tried using something like this.?

`$.changes[*].oldValue.Actions[?(@.ActionTypeCode == "02")].ActionStartDate`

If you can have a define variable operator and use the above filter, you should be getting the ActionStartDate, that can be used in you subsequent operations.

---

<div class="post-metadata">

**Author:** ![Blazelip](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/blazelip/32/17177_2.png) [@Blazelip](https://developer.sailpoint.com/discuss/u/Blazelip)\
**Post date:** [October 29, 2024, 10:27am UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/5 "2024-10-29T10:27:37Z")

</div>

> [@jesvin90](#):
>
> Actions[?(@.ActionTypeCode == “02”)].ActionStartDate

 ![image](https://global.discourse-cdn.com/sailpoint/original/3X/0/e/0ee440247e10732621da5cd3be69b14aca2f331a.png)

I’ve tried, since the oldValue value is represented as a JSON like string, not a JSON, therefore JSONPath editor throws an error and Sailpoint doesn’t dive deeper than oldValue key-pair.

---

<div class="post-metadata">

**Author:** ![jesvin90](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jesvin90/32/5301_2.png) [@jesvin90](https://developer.sailpoint.com/discuss/u/jesvin90)\
**Post date:** [October 29, 2024, 3:18pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/6 "2024-10-29T15:18:20Z")

</div>

Hi @Blazelip,

Looking at your incoming data (Identity attribute), you may need to convert this attribute first into a different format using a transform (Probably a replace transform).

The transformed value can then be called in the workflow so that it can be correctly parsed.

---

<div class="post-metadata">

**Author:** ![Blazelip](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/blazelip/32/17177_2.png) [@Blazelip](https://developer.sailpoint.com/discuss/u/Blazelip)\
**Post date:** [October 30, 2024, 3:26pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/7 "2024-10-30T15:26:45Z")

</div>

Thank u Jesvin for a timely reply,  
I thought of this, but previously I wanted to make sure that there is no such complex parsing feature by SP workflows.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [December 29, 2024, 3:27pm UTC](https://developer.sailpoint.com/discuss/t/how-to-parse-and-filter-json-string-in-sailpoint-workflows/87193/8 "2024-12-29T15:27:09Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
