Hi all,
I would like to replace "true" by true and "false" by false in a JSON formatted string in Cobol.
For eg : a:"true" need to be replaced as a:true and b:"false" need to be replaced by b:false.
The replacement should happen for all occurences of "true" and "false" in the string .
Basically the requirement to send true or false values in string without being enclosed in quotes.
var j = '{"field1":"true","field2":"false"}';
var o = JSON.parse(j, (k, v) => v === "true" ? true : v === "false" ? false : v);
console.log(o);