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.

Please suggest how to convert object to array in javascript

Ketan Pandey
Tera Expert

Please suggest how to convert object to array in javascript

5 REPLIES 5

manjusha_
Kilo Sage

@Ketan Pandey 

 

var testarr= {};

var secArr = [];

 

testarr.test1 = "ABC";

testarr.test2 = "DEF";

secArr.push(JSON.stringify(testarr));

 gs.print(secArr);

 

Execute above script in background script and its result will as below-

Script: {"test1":"ABC","test2":"DEF"}

 

If this does not help you ,just share your object and required output

 

Thanks,

Manjusha Bangale