How to add key as label for each value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 10:59 PM - edited 06-13-2024 11:23 PM
Hi All,
I want to below highlighted red colour from the each . Could you please help me how to add it.
var string="Terminations for the following employees have been processed today Rock, Joseph|157890 |Dell |rockj@gmail.com|Tampa|Customer Support|USA|06/06/2024|Jun 12, 2024 9:20:20 AM Terminations for the following employees have been processed today Rose, Julie|045678 |RE|roseJ@gmail.com|GU|Customer Support|(None)|06/10/2024|Jun 12, 2024 8:38:07 AM";
@David When I post in community its marking as spam. Could you please look into this.
var fstring=string.trim().split('Terminations for the following employees have been processed today').join('|');
gs.print("fstring"+fstring);
var fields=fstring.split('|');
var users = [];
var obj = {};
//var items = fields.split(/|/);
for (var i=0;i<fields.length;i++) {
obj[fields[i]] = fields[i].toString();
users.push(obj);
}
gs.print(JSON.stringify(users));
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 06:52 AM
Hi Sai,
Our AI picked up on this post because it appears to be spam based on its content. I've gone ahead and released it and is now publicly visible.
Dan