이 질문의 끝 부분에서는 ebay API 호출에서 반환 된 표준 JSON이 있습니다.JSON 구문 분석 @
나는 그 중 대부분을 구문 분석하는 데 아무런 문제가 없습니다.
var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];
for (var i = 0; i < items.length; ++i) {
var item = items[i];
var title = item.title;
var timeLeft= item.sellingStatus[0].timeLeft;
}
을하지만, 내가
var currencyID= item.sellingStatus[0].currentPrice[0][email protected];
시도했습니다 통화를 얻는 방법을 알아낼 수 없습니다 그러나 콘솔 화살표 나에게 잘못된 문자를 알려줍니다 타이틀을 얻기 위해, 시간이 나는 사용하고 등 왼쪽 @ 기호를 가리키며 - 그 구문을 분석하는 올바른 방법은 무엇입니까?
{
"findItemsByKeywordsResponse":[
{
"ack":[
"Success"
],
"version":[
"1.12.0"
],
"timestamp":[
"2014-03-26T18:29:40.583Z"
],
"searchResult":[
{
"@count":"100",
"item":[
{
"itemId":[
"151258132867"
],
"title":[
"Apple iPhone 4 - clean esn - Black (Verizon) Smartphone"
],
"globalId":[
"EBAY-US"
],
"primaryCategory":[
{
"categoryId":[
"9355"
],
"categoryName":[
"Cell Phones & Smartphones"
]
}
],
"galleryURL":[
"http:\/\/thumbs4.ebaystatic.com\/m\/mGwHzpyvkph9-nU12sCspxw\/140.jpg"
],
"viewItemURL":[
"http:\/\/www.ebay.com\/itm\/Apple-iPhone-4-clean-esn-Black-Verizon-Smartphone-\/151258132867?pt=Cell_Phones"
],
"productId":[
{
"@type":"ReferenceID",
"__value__":"101787954"
}
],
"paymentMethod":[
"PayPal"
],
"autoPay":[
"false"
],
"postalCode":[
"93905"
],
"location":[
"Salinas,CA,USA"
],
"country":[
"US"
],
"shippingInfo":[
{
"shippingServiceCost":[
{
"@currencyId":"USD",
"__value__":"0.0"
}
],
"shippingType":[
"Free"
],
"shipToLocations":[
"US"
],
"expeditedShipping":[
"true"
],
"oneDayShippingAvailable":[
"false"
],
"handlingTime":[
"2"
]
}
],
"sellingStatus":[
{
"currentPrice":[
{
"@currencyId":"USD",
"__value__":"96.0"
}
],
"convertedCurrentPrice":[
{
"@currencyId":"USD",
"__value__":"96.0"
}
],
"bidCount":[
"17"
],
"sellingState":[
"Active"
],
"timeLeft":[
"P0DT0H0M11S"
]
}
],
"listingInfo":[
{
"bestOfferEnabled":[
"false"
],
"buyItNowAvailable":[
"false"
],
"startTime":[
"2014-03-19T18:29:51.000Z"
],
"endTime":[
"2014-03-26T18:29:51.000Z"
],
"listingType":[
"Auction"
],
"gift":[
"false"
]
}
],
"returnsAccepted":[
"false"
],
"condition":[
{
"conditionId":[
"3000"
],
"conditionDisplayName":[
"Used"
]
}
],
"isMultiVariationListing":[
"false"
],
"topRatedListing":[
"false"
]
},
{
"itemId":[
"360810145746"
],
"title":[
"U Apple iPhone 3GS - 8GB - Black (FACTORY UNLOCKED) Smartphone (C)"
],
"globalId":[
"EBAY-US"
],
"subtitle":[
"****USA SELLER*****FAST SHIPPING*****TOP SELLER****"
],
"primaryCategory":[
{
"categoryId":[
"9355"
],
"categoryName":[
"Cell Phones & Smartphones"
]
}
],
"galleryURL":[
"http:\/\/thumbs3.ebaystatic.com\/m\/mQGXy5hucEtqk6inUKFu67g\/140.jpg"
],
"viewItemURL":[
"http:\/\/www.ebay.com\/itm\/U-Apple-iPhone-3GS-8GB-Black-FACTORY-UNLOCKED-Smartphone-C-\/360810145746?pt=Cell_Phones"
],
"productId":[
{
"@type":"ReferenceID",
"__value__":"99984545"
}
],
"paymentMethod":[
"PayPal"
],
"autoPay":[
"true"
],
"postalCode":[
"10001"
],
"location":[
"New York,NY,USA"
],
"country":[
"US"
],
"shippingInfo":[
{
"shippingServiceCost":[
{
"@currencyId":"USD",
"__value__":"0.0"
}
],
"shippingType":[
"Free"
],
"shipToLocations":[
"US",
"CA",
"GB",
"AU",
"FR",
"HK",
"MT",
"IE",
"IL",
"NZ",
"PH",
"SG"
],
"expeditedShipping":[
"true"
],
"oneDayShippingAvailable":[
"false"
],
"handlingTime":[
"1"
]
}
],
"sellingStatus":[
{
"currentPrice":[
{
"@currencyId":"USD",
"__value__":"84.95"
}
],
"convertedCurrentPrice":[
{
"@currencyId":"USD",
"__value__":"84.95"
}
],
"sellingState":[
"Active"
],
"timeLeft":[
"P12DT0H9M11S"
]
}
],
"listingInfo":[
{
"bestOfferEnabled":[
"false"
],
"buyItNowAvailable":[
"false"
],
"startTime":[
"2013-12-08T18:33:51.000Z"
],
"endTime":[
"2014-04-07T18:38:51.000Z"
],
"listingType":[
"StoreInventory"
],
"gift":[
"false"
]
}
],
"returnsAccepted":[
"true"
],
"condition":[
{
"conditionId":[
"3000"
],
"conditionDisplayName":[
"Used"
]
}
],
"isMultiVariationListing":[
"false"
],
"discountPriceInfo":[
{
"originalRetailPrice":[
{
"@currencyId":"USD",
"__value__":"449.0"
}
],
"pricingTreatment":[
"STP"
],
"soldOnEbay":[
"false"
],
"soldOffEbay":[
"false"
]
}
],
"topRatedListing":[
"true"
]
}
당신이 사용할 수있는'VAR currencyID = item.sellingStatus [0] .currentPrice [0] [ '@ currencyId'] 나는 ... 그들이 포맷 할 이유가있을 때' – Biffen