VinhQuang
(Vinh Quang Tran)
1
This is my JsonObject:
![This image shows a JSON structure for parts, which includes general information, supplier data, and part data sections with various properties like supplier UUID, status, stock, price, part numbers, product SKU, and product title. (Captioned by AI)](https://global.discourse-cdn.com/uipath/original/4X/3/5/2/3520fa804bf05b3bf528243c6086a6c666b711a4.png)
To check if the JsonObject contains key parts I can use this in If activity:
JsonObject.ContainsKey(“parts”)
But how can I check if JsonObject contains key supplierData of key stock.
This expression don’t work:
JsonObject.ContainsKey(“parts”)(“supplierData”) or
JsonObject.ContainsKey(“parts”)(“supplierData”)(“stock”)
I don’t want use For each activity in dit case. Do somebody any idee?
postwick
(Paul Ostwick)
2
JsonObject("parts").ContainsKey("supplierData")
ppr
(Peter Preuss)
3
there are several methods
One of them is a relative JSON Path looking for SuplierData at any level
Assign Activtiy:
hasFound =myJOBject.SelectTokens("..supplierData").Any()
ppr
(Peter Preuss)
4
in Addition to above just a few visualizations:
![grafik](https://global.discourse-cdn.com/uipath/original/4X/7/8/1/781fb2ed59470af1e01218062148d7f004da5a0e.png)
Also we can adapt e.g. returning the path:
![grafik](https://global.discourse-cdn.com/uipath/original/4X/1/2/6/12666c47e6aa945419985f894e490bb3ef66bcb0.png)
VinhQuang
(Vinh Quang Tran)
5
Greate, thank you very much!
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.