javascript - javascipt json 轉(zhuǎn)數(shù)組 大神來
問題描述
[{'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怎么轉(zhuǎn)化為 [’http://vrjx.zhed.com/Public/mht.jpg’, ’http://vrjx.zhed.com/Public/mht.jpg’, ’http://vrjx.zhed.com/Public/mht.jpg’]用JavaScript 怎么轉(zhuǎn)
問題解答
回答1: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']回答2:
jsonData.map(function (item) { return item.xc_images })回答3:
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);
將字符串轉(zhuǎn)成對象再操作
相關文章:
1. mysql索引 - mysql的表如何重新組織(或生成)索引?2. python selenium 獲取圖片驗證碼3. Python爬蟲的亂碼問題?4. 請問這個課程講師是否有講PHP開發(fā)課程,他所講PHP課程名稱是什么?謝謝!5. php 如何獲取第一個參數(shù)?6. 如何用筆記本上的apache做微信開發(fā)的服務器7. Python中的占位符問題8. android - Python代碼轉(zhuǎn)為java代碼?9. android - 類似微信朋友圈或者QQ空間說說那種點擊圖片放大,并且有放大縮小手勢,左右滑動圖片手勢效果10. android - 怎樣才能在連接本地WIFI是通過 3G/4G 實現(xiàn)微信分享?
