I have a JSON like this:
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"
}
]
What I need is to run a search inside attributes
, find if this Object has, for eg. attribute_pa_rozmiar=m
and get corresponding image_src
. Sorry for such a bloated JSON, but it's the only way I could get it out.