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.
UIPATH, Automation Anywhere, Power Automate, Power App, Power Bi, Python, SQL
3yUseful
Tech Lead || 3 x UiPath MVP ||Top Process Automation Voice 💡|| UiPath Ai Hackathon runner ||Certified UiPath Community Trainer
3yGreat Work Divyashree Muddagangaiah
Agentic AI + Automation - Helping organizations in building AI Agents for BFSI
3yMuch needed Divyashree Muddagangaiah