i would like to how can we parse a json like this using javacsript till the last element using for loop i have completed upto this but i am getting the result as [object,object],[object,object] in the first lart and 2 in second and [object,object] in the third how can alert each and every value in the json array
[
    {
        "location": [
            {
                "building": [
                    "Default Building"
                ],
                "name": "Default Location"
            }
        ],
        "name": "Default Organization"
    },
    {
        "location": [
            {
                "building": [
                    "test_loc1_building1",
                    "test_loc1_building2"
                ],
                "name": "test location1"
            },
            {
                "building": [
                    "test_loc2_building2"
                ],
                "name": "test location2"
            }
        ],
        "name": "test Organization"
    }
]
the code i have been working is
function orgname()
{
    var json = <?php echo $response ?>;
    alert(json);
    alert(json.length);
    for(var i=0; i<json.length; i++)
    {
        var item = json[i];
        alert(item);   
    }
}
 
     
     
    