YahooショッピングAPIの値取得に関して。
javascript(jquery)でyahooショッピングAPIからデータを取得&表示するサンプルを作成しています。
データはjsonp形式で取得しhtmlに整形して出力するのですが、一部のデータだけ取得できずエラーになってしまいます。
■エラー内容
Uncaught TypeError: Cannot read property 'Medium' of undefined
■yahooショッピングAPIの仕様
http://developer.yahoo.co.jp/webapi/shopping/shopping/v1/itemsearch.html
■作成したソース
var url = yahooショッピングAPIへのリクエストURL
$.getJSON(url , function(data, status){
var item = data.ResultSet[0].Result;
for (var i in item) {
//↓breakpointを設定しこの時点の値を見るとちゃんと値は入っています。
var test = item[i].Image.Medium;
arr_ya_shop.push([
item[i].Name,
item[i].Url,
item[i].Price,
//↓ここで「Medium」がエラーになる。
item[i].Image.Medium
]);
}
〜arr_ya_shopに格納した値の処理〜
});
原因を教えていただけたら幸いです。