a=["http://img1.bicaijia.com/pic_20170104180621","http://img1.bicaijia.com/pic_20170104180631","http://img1.bicaijia.com/pic_20170104180656"]
想要转化为b
b =[{"picUrl":"http://img1.bicaijia.com/pic_20170104180621"},{"picUrl":"http://img1.bicaijia.com/pic_20170104180631"},{"picUrl":"http://img1.bicaijia.com/pic_20170104180656"}]
看到自己两年前问的傻逼问题。。。
let imgList = [
"http://img1.bicaijia.com/pic_20170104180621",
"http://img1.bicaijia.com/pic_20170104180631",
"http://img1.bicaijia.com/pic_20170104180656"];
let list = []
imgList.forEach(function (element, index, arr) {
list.push({picUrl: arr[index]})
});
foreach 循环呗
List<string> bList=new List<string>; foreach(string item in a) { string json="\{\"picUrl\":\""+item+"\"\}"; bList.Add(json); }
b=string.Join(",“, bList);