Javascript – Javascript-JSON-zu-Array-Konvertierungsmaster
PHP中文网
PHP中文网 2017-07-05 11:03:13
0
4
873
[{"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级讲师

Antworte allen(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); 

扔个三星炸死你

将字符串转成对象再操作

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!