Heim  >  Fragen und Antworten  >  Hauptteil

Javascript – Javascript-JSON-zu-Array-Konvertierungsmaster

[{"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中文网2663 Tage vor871

Antworte allen(4)Ich werde antworten

  • 为情所困

    为情所困2017-07-05 11:05:13

    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"]

    Antwort
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-07-05 11:05:13

    jsonData.map(function (item) { return item.xc_images })

    Antwort
    0
  • 伊谢尔伦

    伊谢尔伦2017-07-05 11:05:13

    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); 

    Antwort
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-07-05 11:05:13

    将字符串转成对象再操作

    Antwort
    0
  • StornierenAntwort