Replace crlf in json string

hi,

I need to replace the crlf in a json string but it doesn’t seem to work.

var textArea = Watch.GetJobInfo(8);

textArea.replace(/(?:\r\n|\r|\n)/g, ‘
’);

Watch.SetJobInfo(8, textArea);

Watch.Log("Jobinfo 8’s value is: " + Watch.GetJobInfo(8), 2);Knipsel

You were close. Try this:

var textArea = Watch.GetJobInfo(8);
textArea = textArea.replace(/\r|\n/g, ‘’);
Watch.SetJobInfo(8, textArea);

or in more concise form:

Watch.SetJobInfo(8, Watch.GetJobInfo(8).replace(/\r|\n/g, ‘’));

Thanks Phil, I also solved it and thought I deleted this topic :slight_smile: