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

143
Views
How to access data on the third level of a JSON array Object

I am taking a chance in posting this message for help after looking through over 20+ questions. I could not find an array like the one that I have.

The good news is that I have half of the data that I want from the array. I am missing one last piece of information.

Here is my code.

xhr.onload = function() {
    if(this.status === 200) {
        let response = JSON.parse(this.responseText);
        console.log(response);
        response.rows.forEach(function(row) {
            output += `
            <div>
                <p>${row.number_e164}, ${row.regional_data.rate_center}, ${row.regional_data.rate_center.state}</p>
            </div>
            `;
        })
        document.getElementById('numberdisplay').innerHTML = output;
    }
}
xhr.open('POST', 'provision_helper.php', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.send(data);

Here is a portion of the array.

screenshot of returned object

This displays the number rate center but not the number.

 <p>${row.number_e164}, ${row.regional_data.rate_center}, ${row.regional_data.rate_center.state}</p>

I have tried

 <p>${row.number_e164}, ${row.regional_data.rate_center}, ${row.regional_data.rate_center['state']}</p>

That did not work and just adding state does not work. I can see that the regional data has a different structure. How do I access the state and country iso inside the regional data?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like you are trying to reference them as being inside rate_center, which isn't correct. Try row.regional_data.state and row.regional_data.country_iso instead.

about 4 years ago · Juan Pablo Isaza Report
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!