How can I add an element to a JSON array using the JSON Object Manager

  • 4 April 2022
  • 3 replies

Badge +6



I use the JSON Object Manager regularly for retrieving or setting values from a JSON string.

But how can I actually add elements to an array?

For example, I have a JSON string like {"employer":"Joe","roles":[]} and I would like to add roles so the result should look like {"employer":"Joe","roles":[{"roleID":"developer"},{"roleID":"analyst"}]}


Any ideas how to do that with JSON Object Manager Package?

3 replies

Badge +6


Since you recorded a quickstep using the JSON Object Manager, I was hoping that you could shine your light on my question?

Is would like to know if it is actually possible to create or extend a JSON object using the JSON Object Manager?

Thanks in advance,



Userlevel 5
Badge +9

I dont think you can do it in the JSON Object Manager package...I believe you can only set values there, not actually adding elements...I think the easiest way to do it in Automation 360 would be to have a small JavaScript function that could do it.


var jsonStr = '{"employer":"Joe","roles":[]}';

var obj = JSON.parse(jsonStr)


jsonStr = JSON.stringify(obj); 



you'd just need to make that a function and pass in your JSON as a string in a list as well as the target object add as a string of the same list.


Badge +6

Thanks for your reply. I think that your suggestion to use JavaScript is at least a more elegant solution than doing string manipulations.