JSON - How to get a Child value

Recently I had come up with one scenario which contains a nested JSON elements. which had multiple inner nodes to get a value.

As any other developer does I started deserialization and also started with complex varieties if Solutions like - deserialization array objects, deserialization with looping of each object and try to get inner object using loop and list goes on trail and error based for two days.

When the deadline hits!! all of our brain cells will Start working smart :D It was very simple solution as mentioned below.

IF its a simple JSON - Input your JSON String use deserialization Activity and get the JSON Object Example :

{ ? result : Value?}

We can get a value as output_obj("result").ToString

If Our JSON has nested nodes:

{ ? result :

{ response :

{variables: Value?}

output_obj("result")("response")("variables").ToString

It does not matter how many nodes has been nested we can get the values by using deserialization output Obj and pass the child names just as shown above and we will get the result.



Bharati Patil

UIPATH, Automation Anywhere, Power Automate, Power App, Power Bi, Python, SQL

3 年

Useful

回复
Mudhukrishna Lalapet ????

Tech Lead || 2*UiPath MVP ||Top Process Automation Voice ??|| UiPath Ai Hackathon runner ||Certified UiPath Community Trainer

3 年
Syed Pasha ???

Agentic AI + Automation - Helping organizations in building their Agentic AI solutions

3 年

要查看或添加评论,请登录

Divyashree Muddagangaiah的更多文章

社区洞察

其他会员也浏览了