Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Trying to get all the text from an external webpage with JS (JSON in an array)

I'm trying some things with JS to get all smartphones brands. I found this API : GSMArena API

As you can see, the content is on an array, and I don't know how to get informations in this case.

I thought about different things. I would like to take all the text from URL, remove the array symbols as a string, and then, just take informations with parsing. That's certainly not the best idea possible.

I tried several things to do that, and none are working (using fetch, request, axios ...) :

var getJSON = function (url, callback) {
  var xhr = new XMLHttpRequest();
  xhr.open("GET", url, true);
  xhr.responseType = "json";
  xhr.onload = function () {
    var status = xhr.status;
    if (status === 200) {
      callback(null, xhr.response);
    } else {
      callback(status, xhr.response);
    }
  };
  xhr.send();
};

getJSON("https://gsmarena-api.herokuapp.com/brands", function (err, data) {
  if (err !== null) {
    alert("Something went wrong: " + err);
  } else {
    console.log(data)
  }
});

If you could help me with what I'm trying to, or if you have another idea, that would help a lot ! Thanks :D

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!