Country and code list

Asked

Viewed 1,889 times

1

I’ve searched a lot of places, and I can’t find it. If someone has or knows where I can find a javascript that brings COUNTRY + COUNTRY CODE, could you help? I need for the E-social project, as follows validation table of the same.

inserir a descrição da imagem aqui

  • there is no way to transform this imgaem in excel and register in the system?

  • I have an HTML ready, but the code is very extensive, as I used Viacep javascript for city/ neighborhood/ street/ ibge also search for country but I did not find anything!

2 answers

3

In the Github repository below you have files json and other formats following the standard ISO 3166-1, specifying the country representation in 2-letter, 3-letter and 3-digit formats

https://github.com/juliolvfilho/lista-paises

Github repository with archive JSON according to Annex I Table 06 - eSocial layout version 2.4.01;

https://github.com/alexwedsday/tabela06-paises-eSocial

You can take this file and load it into memory as a Object Array, or use frameworks such as: Nodejs or Angular. To read this file in your host location.

An example if you press memory:

var paises = [{
    "codigo": 13,
    "pais": "Afeganistao",
    "criacao": "-",
    "extincao": ""
  },
  {
    "codigo": 17,
    "pais": "Albania, Republica Da",
    "criacao": "-",
    "extincao": ""
  }
];

function popular() {

  var table = document.getElementsByTagName("table")[0];
  var tbody = table.getElementsByTagName("tbody")[0];
  
  for (var i = 0; i < paises.length; i++) {
  
  tbody.innerHTML +=
  "<tr><td>" + paises[i].codigo + "</td><td>" 
             + paises[i].pais + "</td><td>" 
             + paises[i].criacao + "</td><td>" 
             + paises[i].extincao + "</td></tr>";
  }
}
<html>

<body onload="popular()">
  <div class="tabela">
    <table>
      <thead>
        <tr>
          <td>Codigo</td>
          <td>Paises</td>
          <td>Criação</td>
          <td>Extinção</td>
        </tr>
      </thead>
      <tbody>
      </tbody>
    </table>
  </div>
</body>

</html>

Note: Always provide a minimum code example.

  • but the problem is that this country code is not equal to the example, it wants an api pro E-social

  • As Julio said, the validation codes in Scottish are different from the one mentioned. But thank you, I have not met, I will use this in other applications.

  • @Juliohenrique he asked for help! But from this example he can create a class and assemble this list with an Array.foreach the other data are Insertion and Creation dates

  • If there is such a table, then in the link http://dados.gov.br/, in some places you must have hidden a file in the *.csv format

  • @Gustavofreire gives a look I added the file you were looking for, I used all the tips of the comments and generated the json file.

  • I also added how to make the table from javascript. @Gustavofreire

  • ball show @alxwca

Show 2 more comments

0

I don’t know any API you can get such data from.

I think it is easier to create a table for consultation.

Use the Smallpdf to convert the PDF and import the data into your table.

  • I used HTML anyway, I also found nothing related!

  • Sorry, I didn’t get your comment. You just want to display the table that is in the PDF in an HTML page?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.