I am working on my webdesign assignment based around ajax. I am having a problem with the JSON.parse() function. The problem goes as follows, I perform a get request on my JSON database using ajax:
artist_list = $.ajax({
    dataType: "json",
    async: false,
    method: "GET",
    url: "/database/artists.json",
    error: function (xhr) {
        console.log("AJAX error:", xhr.status);
    },
    success: function(xhr, responseText) {
        console.log("Ajax operation succseded the code was:", xhr.status);
        console.log("This is the output", responseText);
        response = responseText;
        console.log("Parsing artist list");
        JSON.parse(response);
        console.log("Artist list parsed");
    },
    done: function(data, textStatus, jqXHR){
        console.log("data:", data);
        console.log("Response text",jqXHR.responseText);
    }
})
The console log of the responseText matches what the JSON file I wanted but, when I run response text through a for loop the log returns the JSON file char by char:
artist_list = artist_list.responseText;
JSON.parse(artist_list);
console.log(artist_list);
for(var i = 0; i < 1; i++) {
    console.log("generating artist,", i);
    console.log("which is:", artist_list[i]);
    index = parseInt(i);
    index = new artist_lite(artist_list[i]);
    artist_lite_dict.push(index);
}
The console returns:
generating artist, 0
which is: {     
The list is limited to one because of the lenght of the JSON object which I am trying to pass through. The JSON can be found here https://github.com/Stephan-kashkarov/Collector/blob/master/main/database/artists.json along with the whole code for testing purposes.
Thanks for your help! - Stephan
 
    