私のjsonデータにこのようなエントリが多数あります。 「タイプ」は、twの属性、すなわち所得と経費からなる。 JavaScriptを使用する際にtype = "費用"の "label"を印刷するにはどうすればいいですか? 以下のjsonデータは単なる例です。 Check the image to get a better idea of json data.jsonデータのフィルタを追加する方法
"expenses_veterinary":{
label:"Veterinary, breeding, and medicine"
name:"expenses_veterinary"
total:0
type:"expense"
}
console.log($ctrl.gold_standard_categories); prints all the json data.
私は以下の書かれたコードを試してみましたが、その作業はありません。
if($ctrl.gold_standard_categories.name.type=expense){
console.log($ctrl.gold_standard_categories.label);
}
JSON.parse($ ctrl.gold_standard_categories)[0] .LABEL? – Booster2ooo