cancel
Showing results for 
Search instead for 
Did you mean: 

Convert string to json and then iterate through the JSON

kapil775
Deputy Chef I
Deputy Chef I

Hi everyone,

I have pasted a sample JSON below which is in string format.  I need to do below two activities. Please suggest how to do it in Workato.

1. Convert the string to JSON object.

2. Iterate through the two "results" objects present inside the JSON.

 

{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"date_created": "2024-09-17T00:43:47.536708Z",
"user": "ld",
"object_repr": "SOX Test Access Level <fy24-sox-test-dl-sox-test-access-level>",
"parent_repr": "FY24 SOX Test <fy24-sox-test>",
"action": "UPDATED",
"comment": "",
"object_type": "Access Level",
"object_id": "270231",
"parent_type": "Access Container",
"parent_id": "312767",
"audit_fields": [
{
"action": "ADDED",
"field_name": "member_users",
"field_data": "osebastian",
"object_id": "24150",
"object_type": "user"
},
{
"action": "ADDED",
"field_name": "member_users",
"field_data": "jguieb",
"object_id": "27870",
"object_type": "user"
},
{
"action": "ADDED",
"field_name": "member_users",
"field_data": "gorino",
"object_id": "31933",
"object_type": "user"
}
]
},
{
"date_created": "2024-07-12T00:42:47.986838Z",
"user": "ldeguzman",
"object_repr": "FY24 SOX Test <fy24-sox-test>",
"parent_repr": "",
"action": "UPDATED",
"comment": "",
"object_type": "Access Container",
"object_id": "312767",
"parent_type": null,
"parent_id": null,
"audit_fields": [
{
"action": "REMOVED",
"field_name": "delegates",
"field_data": "osebastian",
"object_id": "24150",
"object_type": "user"
}
]
}
}

1 ACCEPTED SOLUTION

Prudvi
Executive Chef II
Executive Chef II

Hi @kapil775,
Did you try using Parse JSON document action.
Regards,
Prudvi

View solution in original post

1 REPLY 1

Prudvi
Executive Chef II
Executive Chef II

Hi @kapil775,
Did you try using Parse JSON document action.
Regards,
Prudvi