Filtering Json Array

Hi All,

I’m new to UIPath and have been self-learning. One of my tasks was to call an API, which provides the following order data. It has nested elements as: Orders -> OrderDetails -> URLs. I would like to “filter out” Orders, where the “URLs” value contains “bestbuy”. I would then loop thru this “updated” JsonArray to place an order.

I’ve tried to determine if LINQ can be used, but I’m not familiar enough with that to get that done. Is there a good solution to this?

Original JsonArray
[
{
“RequestNo”: “100”,
“Name”: “John Smith”,
“OrderDetails”: [
{
“OrderDetailId”: 1,
“ItemCode”: “A1”,
“Qty”: 1,
“URLs”: [
“test.url/A1-Product”
]
}
]
},
{
“RequestNo”: “101”,
“Name”: “Mary Smith”,
“OrderDetails”: [
{
“OrderDetailId”: 2,
“ItemCode”: “B1”,
“Qty”: 1,
“URLs”: [
“bestbuy.url/B2-Product”
]
}
]
}
]
After filtering, the desired json output below excludes RequestNo “101” because the URLs contained "bestbuy"
[
{
“RequestNo”: “100”,
“Name”: “John Smith”,
“OrderDetails”: [
{
“OrderDetailId”: 1,
“ItemCode”: “A1”,
“Qty”: 1,
“URLs”: [
“test.url/A1-Product”
]
}
]
}
]

Hey jmj, the 4 rpa challenge is all about parsing jsons and json arrays. You can find my guide to it right here, https://youtu.be/tapmE5YiO8Y Let me know, if that solved it for you :slight_smile:

1 Like