Sending JSON.stringify() is sending Object Object

Community Alums
Not applicable

Hi Team,

 

On sending data from script include using JSON.stringify(arr),we are getting message as [{}] ,we are only sending single value for a scenario. 

 

But when we print the value before JSON.stringify , we do get the proper message in gs.info() as "Carrier" .This value is not getting sent using stringify

2 ACCEPTED SOLUTIONS

Samaksh Wani
Giga Sage
Giga Sage

Hello @Community Alums 

 

use :-

JSON.stringify(arr.toString());

 

Plz Mark my Solution as Accept, if you find it Helpful.

 

Regards,

Samaksh

 

 

 

 

View solution in original post

 

var fixedByChoice = JSON.parse(answer);
var nameArr = fixedByChoice.split(',');  // add these line after above one.

for(var i=0; i<namesArr.length;i++){ // replace your for loop with mine
// ur code
}

 

 

Plz Mark my Solution as Accept, if you find it Helpful.

 

Regards,

Samaksh

View solution in original post

8 REPLIES 8

 

var fixedByChoice = JSON.parse(answer);
var nameArr = fixedByChoice.split(',');  // add these line after above one.

for(var i=0; i<namesArr.length;i++){ // replace your for loop with mine
// ur code
}

 

 

Plz Mark my Solution as Accept, if you find it Helpful.

 

Regards,

Samaksh

Community Alums
Not applicable

its working now

@Community Alums 

why would you use toString() on arr while using stringify?

Can you explain?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

@Ankur Bawiskar Yea it was incorrect. My Bad. Now its working