gpt4 book ai didi

Javascript解析json对象

转载 作者:行者123 更新时间:2023-11-30 21:02:52 26 4
gpt4 key购买 nike

<分区>

我正在尝试使用 javascript 解析以下(已验证)json 字符串。我试过下面的代码,但它似乎没有用。

代码:

var obj = JSON.parse(data);
alert(obj.Design_Lump_Sum[1]);
alert(obj[1]);

json 对象:

     {
"Capex_Lump_Sum":
{
"Pipework and associated fittings": "86086.9",
"Cable Trays": "10410.4",
"New Mechanical Services Switchboard": "23209.28",
"Decommissioning removal of Redundant Mechanical Plant": "28342.32",
"Electrical system labelling": "473.2",
"Handover Documentation": "2957.5",
"Mechanical system labelling": "946.4",
"Service and Maintenance during DL": "16196.46",
"Painting": "9227.4",
"Submain Cabling": "27471.63",
"Construction Works": "17464.63",
"Decommissioning removal of redundant mech electrical plant": "5323.5",
"Framed AsBuilt Drawings": "591.5",
"Pre Post Air Balancing": "10883.6",
"Innotech DDC controls and associated cabling": "23831.54",
"LSL": "2663.0",
"Testing and Commissioning": "4519.06",
"Temporary air conditioning": "87243.88",
"Supply and installation of Air Handling Units Condensor Units": "194521.85",
"133.0": "105.0",
"Ductwork Dampers Louvres": "96018.19",
"Building certifier": "7038.85",
"Facility Manager Training": "1183.0",
"AMS": "5915.0",
"Pre Post Site Acoustic Testing": "5867.68",
"Penetrations and Fire Sealing": "3903.9"
},

"Design_Lump_Sum":
{
"Electrical Services Design": "6915.82",
"Mechanical Services Design": "13569.01"
},

"Opex_Lump_Sum":
{"Testing and Commissioning": "1200.0"}
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com