亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

JSON篩選, 謝謝,

JSON篩選, 謝謝,

? //這是新菜單? 從下面的舊菜單篩選出來的 請問怎么做成這樣?????????//新菜單從舊菜單篩選出來的 ????var?newMenuListJSonStr?=?[ ????????{ ????????????"title":?"實時監測", ????????????"icon":?"new/t-1", ????????????"spread":?true, ????????????"children":?[{ ????????????????"title":?"用能分布可視化", ????????????????"iconCls":?"thirdLevelMenu/57", ????????????????"href":?"energyMonitor/energyDistributionVisual" ????????????},?{ ????????????????"title":?"變配電監測", ????????????????"icon":?"thirdLevelMenu/56", ????????????????"href":?"energyMonitor/byqSVGMonitor" ????????????}] ????????} ????]; ????//舊菜單 ???????? ?????????var?oldData?=?[{ ????????????"iconCls":?"new/t-1", ????????????"id":?"4754406", ????????????"name":?"實時監測", ????????????"pid":?"0", ????????????"subFunctionMenuList":?[ ????????????????[{ ????????????????????"iconCls":?"c_sbjb", ????????????????????"id":?"4754407", ????????????????????"name":?"能耗可視化管理", ????????????????????"pid":?"4754406", ????????????????????"subFunctionMenuList":?[ ????????????????????????[{ ????????????????????????????"iconCls":?"thirdLevelMenu/57", ????????????????????????????"id":?"4754408", ????????????????????????????"name":?"用能分布可視化", ????????????????????????????"pid":?"4754407", ????????????????????????????"subFunctionMenuList":?[ ????????????????????????????????[ ????????????????????????????????] ????????????????????????????], ????????????????????????????"url":?"energyMonitor/energyDistributionVisual" ????????????????????????},?{ ????????????????????????????"iconCls":?"thirdLevelMenu/56", ????????????????????????????"id":?"4754467", ????????????????????????????"name":?"變配電監測", ????????????????????????????"pid":?"4754407", ????????????????????????????"subFunctionMenuList":?[ ????????????????????????????????[ ????????????????????????????????] ????????????????????????????], ????????????????????????????"url":?"energyMonitor/byqSVGMonitor" ????????????????????????}] ????????????????????], ????????????????????"url":?"energyMonitor" ????????????????}] ????????????], ????????????"url":?"/" ????????}];
查看完整描述

9 回答

?
ExiaGo

TA貢獻20條經驗 獲得超18個贊

謝邀請,我也沒有篩選過 json 數據,我是這樣想的,先創建一個空的對象,如:

var newMenuListJSonStr = [

? ? {

? ? ? "title" : "",

? ? }?

];

然后遍歷舊的 json 數據,將舊數據賦值新的空對象

newMenuListJSonStr[0].title = oldData[0].name

newMenuListJSonStr[0].title //實時監測

看看別的大神是否這樣做的?請告知。

查看完整回答
反對 回復 2017-06-19
  • 9 回答
  • 1 關注
  • 3393 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號