Good Day!
How do I get values on my json via dot(.) syntax??
here is my json data:
[
{"productName":"31","description":"this is a red item","quantity":"","price":"15"},
{"productName":"35","description":"this color is blue","quantity":"","price":"600"}]
I tried using
var temp = $.cookie('Table_Rows'); <-- which contains the json data above;
for (var key in temp ) {
if (temp.hasOwnProperty(key)) {
var obj = temp[key];
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
console.log(prop + " = " + obj[prop]);
}
}
}
}
then I got this log on my console:
0 = [
0 = {
0 = "
0 = p
0 = r
0 = o
0 = d
0 = u
0 = c
0 = t
0 = N
0 = a
and so on..
Can you please help me comeup with a correct method please..
I want to access it like temp.productName
. I know that this must be an easy fix, but its really confusing me right now. Thank you and have a nice day!