Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Merge Multiple JSON key value into single array

rahulrockkk
Tera Contributor

Hi Team,

 

How to merge the multiple JSON key-value pair in the client-side script?

Current Format:

 

{"name1":"test1","name2":"test2"},{"name3":"test3","name4":"test4"}

 

Expected Format:

 

[{"name1":"test1","name2":"test2"},{"name3":"test3","name4":"test4"}]

1 REPLY 1

Geoff_T
Mega Sage

Hello,

You can just push the value to the array like:

var data = {"name1":"test1","name2":"test2"},{"name3":"test3","name4":"test4"};

var dataArray = [];
dataArray.push(data);

 

Geoff