When calling JSON.stringify
on a string, newline characters are escaped and the string is wrapped in quotes. It looks like you want neither to happen. Note also that applying String
to a string is useless.
So just drop those two function calls:
let xyz = data[property].Users__c;
let arr = xyz.split("\r\n");
console.log('XYZ :' + xyz);
console.log('ARR: ' + arr);
If for some reason the Users__c
property would be some other data type than a string, then the question is what you expect split
to produce... You could keep the String
call to avoid errors in that case, but you'd need to look into what you then really want to happen:
let xyz = String(data[property].Users__c);
let arr = xyz.split("\r\n");
console.log('XYZ :' + xyz);
console.log('ARR: ' + arr);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.