Skip to main content
Solved

How do I add nodes to a JSON object that aren't at the root level?

  • July 25, 2025
  • 3 replies
  • 95 views

Forum|alt.badge.img

Hi how can I create like this json format : 
 

{
"name1": "MyData",
"version1": "1.0",
"APPS": {
"name2": "MyData",
"version2": "1.0"
}
}

for name1 and version1 i’ll put in the Json node path $$ what about the others key values  ?  

Best answer by DS78

@lahcenAglagal  You can do that using “Json” Package and actions available within this package.

 

Select the value type as dictionary while adding the APPS node.

 

 

You will get the exact JSON as you wanted:

 

3 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • July 25, 2025

@lahcenAglagal Unfortunately, you cannot. You can build it using string handling, or by writing your own JavaScript or Python code. 


jshaji
Forum|alt.badge.img+5
  • Navigator | Tier 3
  • July 25, 2025

Hi how can I create like this json format : 
 

{
"name1": "MyData",
"version1": "1.0",
"APPS": {
"name2": "MyData",
"version2": "1.0"
}
}

for name1 and version1 i’ll put in the Json node path $$ what about the others key values  ?  

Hey ​@lahcenAglagal  you can use the String replace Action to replace particular Nodes with Updated values. You can create an default JSON Template in a String variable like:

{
"name1": "",
"version1": "",
"APPS": {
"name2": "",
"version2": ""
}
}

And use the Source String as the Whole template, Find as “name2”: “”

and Replace as “name2”:”$<The value you want>$”

or you can enter “NULL” in the JSON Response and replace that as well.


DS78
Most Valuable Pathfinder
Forum|alt.badge.img+13
  • Most Valuable Pathfinder
  • Answer
  • July 28, 2025

@lahcenAglagal  You can do that using “Json” Package and actions available within this package.

 

Select the value type as dictionary while adding the APPS node.

 

 

You will get the exact JSON as you wanted: