我正在尝试解析下面的JSON响应中的salehistory。我可以像这样
获取属性对象下的所有节点oJSON.data("属性&#34)。项(0).item("老式&#34)。项("上次更改时间&#34)
然而,当我试图深入时,我会遇到错误
我试过了
oJSON.data("属性")。item(0).item(" salehistory")。item(" salesearchdate")但不返回任何东西。
我认为它与属性是对象这一事实有关,而SalesHistory是Property内部的一个对象,但我似乎无法从销售历史水平中获取这些值。
下面是我要解析的JSON结构。任何帮助,将不胜感激。 。
{
"status": {
"version": "1.0.0",
"code": 0,
"msg": "SuccessWithResult",
"total": 1,
"page": 1,
"pagesize": 10
},
"property": [
{
"identifier": {
"obPropId": 3464768712115,
"fips": "12115",
"apn": "0283080001",
"apnOrig": "0283080001"
},
"lot": {
"lotSize1": 0.837
},
"address": {
"country": "US",
"countrySubd": "FL",
"line1": "7580 PRESERVATION DR",
"line2": "SARASOTA, FL 34241",
"locality": "Sarasota",
"matchCode": "ExaStr",
"oneLine": "7580 PRESERVATION DR, SARASOTA, FL 34241",
"postal1": "34241",
"postal2": "5201",
"postal3": "R038"
},
"location": {
"accuracy": "Street",
"elevation": 0,
"latitude": "27.267342",
"longitude": "-82.419812",
"distance": 0,
"geoid": "MT30003379,RS0000548079,SD67554,SS156496,SS156498,SS190868"
},
"summary": {
"propclass": "Single Family Residence / Townhouse",
"propsubtype": "SINGLE FAMILY",
"proptype": "SFR",
"yearbuilt": 2005,
"propLandUse": "SFR"
},
"building": {
"size": {
"universalsize": 4256
},
"rooms": {
"bathstotal": 5,
"beds": 4
}
},
"vintage": {
"lastModified": "2015-9-11",
"pubDate": "2015-10-7"
},
"salehistory": [
{
"salesearchdate": "2009-3-30",
"saleTransDate": "2009-3-30",
"amount": {
"saleamt": 1250000,
"salerecdate": "2009-3-30",
"saledisclosuretype": 0,
"saledocnum": "37737",
"saletranstype": "Resale"
},
"calculation": {
"priceperbed": 312500,
"pricepersizeunit": 294
}
},
{
"salesearchdate": "2005-8-9",
"saleTransDate": "2005-8-9",
"amount": {
"saleamt": 185000,
"salerecdate": "2005-8-15",
"saledisclosuretype": 0,
"saledocnum": "181999",
"saletranstype": "Resale"
},
"calculation": {
"priceperbed": 46250,
"pricepersizeunit": 43
}
}
]
}
]
}
答案 0 :(得分:0)
实际上我能够理解它。
由于它是属性对象中的嵌套对象,我需要执行以下操作来访问它。
response.write oJSON.data(“property”)。item(0).item(“salehistory”)。item(0).item(“amount”)。item(“saleamt”
在销售历史记录之后添加.item(0)允许我访问salehistory对象