Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

158
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda