Error:o.Detail:Unexpected token:o in flow designer action

devendranarun
Tera Guru

Hello All,

I have written the below code snippet in my Actions in Flow Designer.

var response = inputs.parameter;
var obj =JSON.parse(JSON.stringify(response));

 

outputs.employee = obj.EmployeeNumber;
if(outputs.employee)
{
outputs.iscontractor = 'no'
}
else
{
outputs.iscontractor = 'yes'
}

Action input type is String.

I am receiving an Error "Error:o.Detail:Unexpected token:o"

Any help on this is highly appreciated.

Thanks,
Arun Devendran

1 ACCEPTED SOLUTION

Hello Ankur,

Thanks for replying.

I have made modifications;

var response = inputs.parameter;
var parser = new JSON();
var obj = parser.decode(response);
outputs.employee = obj.EmployeeNumber;

This is working fine now.

 

Thanks,
Arun Devendran

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

which line is giving error?

if your input is string then why to stringify again?

Regards
Ankur

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

Hello Ankur,

Thanks for replying.

I have made modifications;

var response = inputs.parameter;
var parser = new JSON();
var obj = parser.decode(response);
outputs.employee = obj.EmployeeNumber;

This is working fine now.

 

Thanks,
Arun Devendran

@devendranarun 

this is what I mentioned exactly. no need to stringify

Glad to know.

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

 

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

Hello Ankur,

Used JSON.parse() before using stringify, but it didnt work.

This one parser.decode helped solving the issue.

Best Regards,
Arun Devendran