SOURCE

var str = [{"id":27,"surl":"https://detail.tmall.com/item.htm?id=653942158020","platid":"1","platidname":"天猫网","platidurl":"www.tmall.com","itemid":"653942158020","state":"0"},{"id":19,"surl":"https://detail.tmall.com/item.htm?id=645035988290","platid":"1","platidname":"天猫网","platidurl":"www.tmall.com","itemid":"645035988290","state":"1"},{"id":18,"surl":"https://detail.tmall.com/item.htm?id=682291674724","platid":"1","platidname":"天猫网","platidurl":"www.tmall.com","itemid":"682291674724","state":"1"}];

var last = JSON.stringify(str,['id']);
var reg = new RegExp(/[^0-9a-zA-Z,:]/,"g")
var k = last.replace(reg,'');
var t = k.split(',')[1];

console.log(last);
//console.log(k);
//console.log(t);

var a = new RegExp(/[^0-9]+/,"g")
var b = last.replace(a,',');
console.log(b);
var reg2 = new RegExp(","); // 不加'g',仅删除字符串里第一个"a"
var a2 = b.replace(reg2,"");
console.log(a2); 


var c = new RegExp(/[^a-zA-Z]/,"g")
var d = last.replace(c,'');
//console.log(d);

const result = Array.from(new Set(last))
//console.log(result)
var str1 = [... new Set(d)].join("")
console.log(str1)
console.log(str1+":"+a2)
console 命令行工具 X clear

                    
>
console