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.

How to separate Json Array of Strings

Chinmayee1
Giga Contributor

Hi , 

I need to separate each of these below arrays into 8 separate arrays so that I can pass these to a method. Now the length shows as the length of total string and not 8.

contentMap received :[

{"column":"u_kb_index","content":"SCOM_CUSTOM_Service-Health_BY0VBV","table":"u_kb_template_gems","number":"KB0022149"},

{"column":"u_kb_source","content":"SCOM","table":"u_kb_template_gems","number":"KB0022149"},

{"column":"u_kb_monitor_description","content":"<p>QA Airwatch API Service is Down<br /><br /> <span style=\"font-family: Calibri;\">Summary: </span><br /><span style=\"font-family: Calibri;\">The Airwatch Application Service or IIS or World Wide Web Publishing Service is not running</span></p>","table":"u_kb_template_gems","number":"KB0022149"}]

Please help.

Thanks in Advance,

Chinmayee Mishra

 

1 ACCEPTED SOLUTION

So that seems to be alright now. You have 8 entries. So length is returning 8?

Then you can loop through that like:

for(var i=0;i<contentArr.length;i++){

gs.info(JSON.stringify(contentArr[i]));

//do something with the object

}

 

View solution in original post

11 REPLIES 11

length of arrayA :[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

 

This is the log

So that seems to be alright now. You have 8 entries. So length is returning 8?

Then you can loop through that like:

for(var i=0;i<contentArr.length;i++){

gs.info(JSON.stringify(contentArr[i]));

//do something with the object

}