I am retrieving JSON data from a remote server in an associative array format . The structure of the associative array is:
data=
{
"1":[{"project_id":1,"project":"IET1"},{"project_id":2,"project":"IET2"}],
"2":[{"project_id":3,"project":"IET3"}],
"3":[{"project_id":4,"project":"IET4"},{"project_id":5,"project":"IET5"}]
}
This is the exact format that I am getting from the ajax response. Now when I trying to traverse it using the following way:
var obj = JSON.parse(data, function (key, value) {
alert(key + " " + value) // will alert => "project_id 1"
}
I am trying to iterate using the main index ("1", "2" etc). How can I do this? I have a searched a lot but I didn't find any solution.