JSON
links {
name: "card";
url: "http://google.com";
}
j.each(branch.links, function(i, supportlinks) {
console.log(supportlinks["card"].url);
});
如何将其转换为以下内容,并使用名为url
的链接输出card
?
links {
card: "http://google.com";
}
答案 0 :(得分:1)
var result = {};
j.each(branch.links, function(i, supportlinks) {
supportlinks[supportlinks.name] = supportlinks.url;
});
console.log(result);