Hello everybody!
When running the code below,
I get the following error:
where can i be wrong?
When running the code below,
B4X:
ProgressDialogShow2("Carregando Dados...",False)
Dim GetAddressJob As HttpJob
GetAddressJob.Initialize("GetAddress", Me)
GetAddressJob.Download("https://api.portaldatransparencia.gov.br/api-de-dados/ceis?codigoSancionado=09743631895&pagina=1")
GetAddressJob.GetRequest.SetHeader("chave-api-dados",API_KEY)
Wait For (GetAddressJob) JobDone(GetAddressJob As HttpJob)
ProgressDialogHide
If GetAddressJob.Success Then
Dim parser As JSONParser
parser.Initialize(GetAddressJob.GetString)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim dataInicioSancao As String = colroot.Get("dataInicioSancao")
Dim numeroProcesso As String = colroot.Get("numeroProcesso")
Dim pessoa As Map = colroot.Get("pessoa")
Dim cnae As Map = pessoa.Get("cnae")
Dim grupo As String = cnae.Get("grupo")
Dim razaoSocialReceita As String = pessoa.Get("razaoSocialReceita")
Dim dataFimSancao As String = colroot.Get("dataFimSancao")
Dim orgaoSancionador As Map = colroot.Get("orgaoSancionador")
Dim nome As String = orgaoSancionador.Get("nome")
Next
Log($"razaoSocialReceita: ${razaoSocialReceita}"$)
Log($"grupo: ${grupo}"$)
Log($"dataInicioSancao: ${dataInicioSancao}"$)
Log($"dataFimSancao: ${dataFimSancao}"$)
' Log($"orgaoSancionador: ${nome}"$)
Log($"numeroProcesso: ${numeroProcesso}"$)
End If
I get the following error:
B4X:
java.lang.RuntimeException: Object should first be initialized (Map).
where can i be wrong?