搜索
javascript - javascipt json 转数组 大神来
PHP中文网
PHP中文网 2017-07-05 11:03:13
[JavaScript讨论组]
[{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/lz.jpg"}]

这样的json怎么转化为 ['http:\/\/vrjx.zhed.com\/Public\/mht.jpg', 'http:\/\/vrjx.zhed.com\/Public\/mht.jpg', 'http:\/\/vrjx.zhed.com\/Public\/mht.jpg']

用JavaScript 怎么转
PHP中文网
PHP中文网

认证0级讲师

全部回复(4)
为情所困
var arr =[{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/lz.jpg"}];
res = arr.map(function(i){return i.xc_images;})
["http://vrjx.zhed.com/Public/mht.jpg", "http://vrjx.zhed.com/Public/mht.jpg", "http://vrjx.zhed.com/Public/lz.jpg"]
女神的闺蜜爱上我
jsonData.map(function (item) { return item.xc_images })
伊谢尔伦
var a = [{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/mht.jpg"},{"xc_images":"http:\/\/vrjx.zhed.com\/Public\/lz.jpg"}];

var res = a.map(e => e.xc_images); 

console.log(res); 

扔个三星炸死你

将字符串转成对象再操作

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板