Convert string false to boolean flase in JSON response

kumarraj764
Participant II

Hi, I have a scenario where many fields in JSON response are coming as string ("true"/"false"). Now I need to replace all of the values from string to Boolean at one shot in Javascript Policy. Any help is highly appreciated.

Sample:

{

field1: "true",

field2: "false"

}

Expected:

{

field1: true,

field2: false

}

This is sample. My JSON response is very huge with many objects and arrays.

0 2 4,294
2 REPLIES 2

This works like a charm. Thanks deboraelkin!!!!