I have a js object in json format,
"monthly_sal":{
"2012_08":"421",
"2012_09":"332",
"2012_10":"332"
},
I would like to access the 2012_08 as year 2012 and month 08, how can i do it on the key. based on this i need to fill the table with its data respectively. I have teh code to split it but not sure how i can apply the same to the json object keys and iterate through the complete object
var number = 2012_08;
var splitstring = number.toString().split('_');
var years = splitstring[0];
var months = splitstring[1];
alert(years + ' years,' + months + ' months');
Use
for in to iterate over the keys, and parseInt to get numbers from the two parts of the key.