Something like this may work for you. Although dealing with the lines containing objects may require more.
var lines = inputData.productName.split("\n");
var obj = {};
for (var i = 0; i < lines.length; i++) {
var pair = lines[i].split(":");
obj[pair[0]] = pair[1];
}
return obj;
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.