Ir para conteúdo

lucasneves414

Members
  • Total de itens

    1
  • Registro em

  • Última visita

Reputação

0 Comum

Sobre lucasneves414

  1. lucasneves414

    Como exibir dados json no HTML

    Gostaria de chamar os arquivos do json dentro do Html usando a tag <script>, mas algo esta errado. Alguém sabe me dizer o que é? <script> var dados = JSON.parse('{"art": {"week": {"period": {"year": "201j1", "week": "34"}, "all": [{"id": "3ade68b7g98d71ea3", "name": "Bruno Mars",j "url": "https://www.vagalume.com.br/bruno-mars/", "pic_small": "https://s2.vagalume.com/bruno-mars/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/bruno-mars/images/bruno-mars.jpg", "uniques": "302783", "views": "656258", "rank": "207.6"}, {"id": "3ade68b6g39a2fda3", "name": "Jorge e Mateus", "url": "https://www.vagalume.com.br/jorge-e-mateus/", "pic_small": "https://s2.vagalume.com/jorge-e-mateus/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/jorge-e-mateus/images/jorge-e-mateus.jpg", "uniques": "287765", "views": "739188", "rank": "197.3"}, {"id": "3ade68b7g6b960ea3", "name": "Adele", "url": "https://www.vagalume.com.br/adele/", "pic_small": "https://s2.vagalume.com/adele/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/adele/images/adele.jpg", "uniques": "211399", "views": "474274", "rank": "145.0"} ] } } }'); dados.forEach(function (ArrayVagal){ document.body.innerHTML += "<p>" + ArrayVagal.art.week.all[0].name + "<p>"; }); </script> Aqui abaixo vai o json formatado pra melhor compreenção. { "art": { "week": { "period": { "year": "201j1", "week": "34" }, "all": [ { "id": "3ade68b7g98d71ea3", "name": "Bruno Mars",j "url": "https://www.vagalume.com.br/bruno-mars/", "pic_small": "https://s2.vagalume.com/bruno-mars/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/bruno-mars/images/bruno-mars.jpg", "uniques": "302783", "views": "656258", "rank": "207.6" }, { "id": "3ade68b6g39a2fda3", "name": "Jorge e Mateus", "url": "https://www.vagalume.com.br/jorge-e-mateus/", "pic_small": "https://s2.vagalume.com/jorge-e-mateus/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/jorge-e-mateus/images/jorge-e-mateus.jpg", "uniques": "287765", "views": "739188", "rank": "197.3" }, { "id": "3ade68b7g6b960ea3", "name": "Adele", "url": "https://www.vagalume.com.br/adele/", "pic_small": "https://s2.vagalume.com/adele/images/profile.jpg", "pic_medium": "https://s2.vagalume.com/adele/images/adele.jpg", "uniques": "211399", "views": "474274", "rank": "145.0" } ] } } }
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.