im new to json. i done my study about json a little while ago but i still have very little knowledge on how to control json output. i made a cart that get json data from the controller using ajax, and i tried to parse the output. eventually i failed to get a result. its stated undefined.
here is my draft
loop hypermart json element {
loop productname element{
get price based on productname + price
}
}
so every mart will have the same product name and different price on each mart. how can i achieve this kind of output? im cornered by question that i yet to have the answer.
this is the json data
[{
"productId":1002,
"productName":"Moghul Faiza Basmathi",
"productPic":"",
"brandName":"Faiza",
"productVolume":"5kg",
"barcode":"9555035703811",
"manufacturer":"Faiza",
"createdBy":{
"userId":2,
"username":"pak.ijan",
"password":"********",
"fullName":"Hizan Ahmad",
"sessionId":"********"},
"dateCreated":"Jul 9, 2014 3:52:08 AM",
"modifiedBy":{
"userId":2,"username":"pak.ijan",
"password":"********",
"fullName":"Hizan Ahmad",
"sessionId":"********"},
"lastModified":"Jul 9, 2014 3:52:08 AM",
"status":1,
"price":[{
"priceId":0,
"hypermart":{
"hypermartId":1,
"hypermartName":"Tesco",
"hypermartLogo":"",
"status":1},
"priceDate":"Jul 13, 2014 12:17:46 PM",
"productPrice":0.0,"status":1},
{"priceId":1,
"hypermart":{
"hypermartId":2,
"hypermartName":"Giant",
"hypermartLogo":"",
"status":1},
"priceDate":"Jul 13, 2014 12:17:46 PM",
"productPrice":0.0,"status":1},
{"priceId":2,
"hypermart":{
"hypermartId":3,
"hypermartName":"Jusco",
"hypermartLogo":"",
"status":1},
"priceDate":"Jul 13, 2014 12:17:46 PM",
"productPrice":0.0,
"status":1}],
"tag":"beras faiza basmathi moghul",
"description":"Moghul Faiza Basmathi",
"category":{
"categoryId":7,
"descEn":"Food",
"descMy":"Makanan"}
}]