0

次のような JSON があります。

    var parse = [
   {
      "variation_id":"34",
      "attributes":{
         "attribute_pa_rozmiar":"m"
      },
      "image_src":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Jellyfish-300x300.jpg",
      "image_link":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Jellyfish.jpg",
      "image_title":"Jellyfish",
      "price_html":"",
      "availability_html":"<p class=\"stock \">10 w magazynie</p>",
      "sku":"",
      "weight":"4 kg",
      "dimensions":"",
      "min_qty":1,
      "max_qty":"10",
      "backorders_allowed":false,
      "is_in_stock":true,
      "is_downloadable":false,
      "is_virtual":false,
      "is_sold_individually":"no"
   },
   {
      "variation_id":"33",
      "attributes":{
         "attribute_pa_rozmiar":"s"
      },
      "image_src":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Desert-300x300.jpg",
      "image_link":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Desert.jpg",
      "image_title":"Desert",
      "price_html":"",
      "availability_html":"<p class=\"stock \">5 w magazynie</p>",
      "sku":"",
      "weight":"4 kg",
      "dimensions":"",
      "min_qty":1,
      "max_qty":"5",
      "backorders_allowed":false,
      "is_in_stock":true,
      "is_downloadable":false,
      "is_virtual":false,
      "is_sold_individually":"no"
   }
][
   {
      "variation_id":"34",
      "attributes":{
         "attribute_pa_rozmiar":"m"
      },
      "image_src":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Jellyfish-300x300.jpg",
      "image_link":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Jellyfish.jpg",
      "image_title":"Jellyfish",
      "price_html":"",
      "availability_html":"<p class=\"stock \">10 w magazynie</p>",
      "sku":"",
      "weight":"4 kg",
      "dimensions":"",
      "min_qty":1,
      "max_qty":"10",
      "backorders_allowed":false,
      "is_in_stock":true,
      "is_downloadable":false,
      "is_virtual":false,
      "is_sold_individually":"no"
   },
   {
      "variation_id":"33",
      "attributes":{
         "attribute_pa_rozmiar":"s"
      },
      "image_src":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Desert-300x300.jpg",
      "image_link":"http://localhost/Fraise-WP/wp-content/uploads/2013/06/Desert.jpg",
      "image_title":"Desert",
      "price_html":"",
      "availability_html":"<p class=\"stock \">5 w magazynie</p>",
      "sku":"",
      "weight":"4 kg",
      "dimensions":"",
      "min_qty":1,
      "max_qty":"5",
      "backorders_allowed":false,
      "is_in_stock":true,
      "is_downloadable":false,
      "is_virtual":false,
      "is_sold_individually":"no"
   }
]

私が必要とするのは、内部attributesで検索を実行し、このオブジェクトが持っているかどうかを見つけることです。attribute_pa_rozmiar=m対応しておりますimage_src。このように肥大化した JSON で申し訳ありませんが、それを取得する唯一の方法です。

4

2 に答える 2