I want to get a list of repositories from my GitHub account and the URL that I am using is https://api.github.com/users/rakeshdas1/repos
. I want to parse it using jQuery and output into a HTML page. The code that I am using to achieve this is:
$(document).ready(function(){
var json = "https://api.github.com/users/rakeshdas1/repos";
$.each(JSON.parse(json), function(idx, obj) {
$("#repos").append("<p>"+obj.name+"</p>");
});
});
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
The first character in the JSON file is '['
and I don't know why jQuery can't parse it