Pokušavam da napravim web shop. Podatke koje preko php-a primam i koji su u json formatu želim da transformišem tako da mogu lakše da ih prikažem na sajtu.
Ono što dobijam od php-a je:
{name: "product 1", price: "150", picture_path: "product-img1.png", color: "white",…}
{name: "product 1", price: "150", picture_path: "product-img1.png", color: "beige",…}
{name: "product 1", price: "150", picture_path: "product-img1.png", color: "orange",…}
{name: "product 2", price: "55", picture_path: "product-img2.png", color: "white", …}
{name: "product 3", price: "155", picture_path: "product-img3.png", color: "beige",...}
a želim da izgleda ovako:
{name: "product 1", price: "150", picture_path: "product-img1.png", color1: "white", color2:"beige", color3:"orange", colorX:....…}
{name: "product 2", price: "55", picture_path: "product-img2.png", color1: "white", …}
{name: "product 3", price: "155", picture_path: "product-img3.png", color1: "beige",...}
Ili
{name: "product 1", price: "150", picture_path: "product-img1.png", colors: { color1:"white", color2:"beige", color3:"orange"},..…}
Kako bi to moglo da se odradi u jQuery?
"You're gettin' the fuck...
I know you're seven !"
"But you'll be a seven year old
walkin' the dog no house motherfucker !"