Deserialise Json and extract Value

Could i please seek your help in extract value of “epic” from below.
{
“workingOrders”: [{
“workingOrderData”: {
“dealId”: “DIAAAADR9NCSTAT”,
“direction”: “BUY”,
“epic”: “ED.D.LHAG.CASH.IP”,
“orderSize”: 25033,
“orderLevel”: 7.7420,
“timeInForce”: “GOOD_TILL_DATE”,
“goodTillDate”: “2020/05/12 07:30”,
“goodTillDateISO”: “2020-05-12T07:30”,
“createdDate”: “2020/05/12 15:31:06:000”,
“createdDateUTC”: “2020-05-12T05:31:06”,
“guaranteedStop”: false,
“orderType”: “STOP”,
“stopDistance”: 13.0,
“limitDistance”: 56.0,
“currencyCode”: “EUR”,
“dma”: false,
“limitedRiskPremium”: null
}
}]
}

@Moses_Selembu - pls try below …

  • add json.net package to your project dependency
  • create a variable like jsonOut type as JObject
  • jsonOut = JOjbect.Parse(JSONResponseVariable)

to get epic -" write like jsonOut(“workorders”)(0)(“epic”).ToString

5 Likes

Hi @Moses_Selembu,
Please use following project it gives you the desired output, or just use following code

jsonObject.Item(“WorkingOrders”)(0).Item(“workingOrderData”).Item(“epic”).ToString

Note :- jsonobject means Deserialized json string
Use UiPath.Web.Activities
image

Hierarchy of your json as follows

image

jasonread.zip (20.9 KB)

2 Likes

Thanks guys, now sorted…

1 Like

Hello Moses,
In this video I do a lot of stuff with JSON (Chapter included) :
1:35 Deserialize simple JSON
2:50 Deserialize a JSON with an Object inside
3:55 Deserialize a JSON with Array inside
6:00 When we use Deserialize JSON Array activity
7:00 Deserialize a JSON with a List of Strings inside

Thanks,
Cristian Negulescu