I've read through a couple of dozen of these questions, but I can't find this solution. I want to output the key of a JSON key:value pair. Assuming the JSON is like this:
{"group":[
{"ed":"BDeveloper","st":"New","type":"B"},
{"ed":"BDeveloper","st":"Cancelled","type":"B"}
]}
I want to scrape the "ed", the "st", etc. out of the pair using jQuery if possible.
I currently have code around it to output the data:
$.getJSON('sum.php', function(JSONsum)
{
var summaryHTML ='';
$.each(JSONsum.group, function (i)
{
console.log("this.ed: ["+i+"] "+this.ed);
// console.log("this.name: ["+i+"] "+this.something??? );
summaryHTML+='<div class=\"grid_3\">'+this.ed+'</div>';
summaryHTML+='<div class=\"grid_1\">'+this.type+'</div>';
summaryHTML+='<div class=\"grid_2\">'+this.st+'</div>';
summaryHTML+='<div class=\"clear\"></div>';
});
$('#summary').append(summaryHTML);
});
But I want to be able to output the key in the console.log and use it in other places, etc.
Is it even possible? Thanks in advance