Javascript-解析长GET请求JSON

Javascript-解析长GET请求JSON,javascript,json,parsing,Javascript,Json,Parsing,我正在通过JS向发送一个GET请求,它可以正常工作。尽管如此,我完全不知道如何解析弹出的长JSON。我想知道第一篇文章的标题 代码: 编辑:我尝试使用console.logresponse['articles'][0];但这会返回一个错误,请使用 @帕特里克:不,我没有。但是我使用的是JS not.NETWORK它会返回什么错误?@Patrick Uncaught TypeError:无法读取UndefinedHanks的属性“0”,这就解决了它!虽然我必须等待选择这个答案 var HttpCl

我正在通过JS向发送一个GET请求,它可以正常工作。尽管如此,我完全不知道如何解析弹出的长JSON。我想知道第一篇文章的标题

代码:

编辑:我尝试使用console.logresponse['articles'][0];但这会返回一个错误,请使用


@帕特里克:不,我没有。但是我使用的是JS not.NETWORK它会返回什么错误?@Patrick Uncaught TypeError:无法读取UndefinedHanks的属性“0”,这就解决了它!虽然我必须等待选择这个答案
var HttpClient = function () {
   this.get = function (aUrl, aCallback) {
       var anHttpRequest = new XMLHttpRequest();
       anHttpRequest.onreadystatechange = function () {
           if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200)
               aCallback(anHttpRequest.responseText);
       }

       anHttpRequest.open("GET", aUrl, true);
       anHttpRequest.send(null);
    }
}
var client = new HttpClient();
client.get('https://newsapi.org/v1/articles?source=google-news&sortBy=top&apiKey=08f3b70e722d46ebab1fdd5b5499f671', function (response) {
    console.log(response);
});
var client = new HttpClient();
client.get('https://newsapi.org/v1/articles?source=google-news&sortBy=top&apiKey=<your-api-key-here>', function (response) {
    var json = JSON.parse(response);

    console.log(json['articles'][0]);
});