Javascript 如何使用JSON中的数组访问对象
这是我的密码 slot.interment.strintetypeid.prices 输出是Javascript 如何使用JSON中的数组访问对象,javascript,json,Javascript,Json,这是我的密码 slot.interment.strintetypeid.prices 输出是 [ { "strPriceID": 1, "decPriceAmount": "15000.00", "created_at": "2017-08-19 02:28:04", "updated_at": "2017-08-19 02:28:04" } ] 如何访问decPriceAmount???您有一个数组。您需要通过索引访问当前项([0]-第一项,因
[
{
"strPriceID": 1,
"decPriceAmount": "15000.00",
"created_at": "2017-08-19 02:28:04",
"updated_at": "2017-08-19 02:28:04"
}
]
如何访问decPriceAmount???您有一个数组。您需要通过索引访问当前项(
[0]
-第一项,因为您只有一项),然后通过
点语法或[]
语法访问该对象的属性
const data=[
{
“strPriceID”:1,
“价格金额”:“15000.00”,
“创建时间”:“2017-08-19 02:28:04”,
“更新时间:”2017-08-19 02:28:04
}];
console.log(数据[0].decpricemount)代码>slot.interment.strInteITypeID.prices[0]。decpriceamunit
nameOfArray[0][“decpriceamunit”]
?