Hi all.
later many try*s i will request some help..
how can i parse this json result ?
I know that json is badly formatted, but I have to find some solution to get the data as it is at the moment.
here is my last try code
but dont works, on the for i = 0 the map mm is not initialized.
thats is strange, because this look a map
how can i parse this result?
ps: the result size is diferent
The result may be different always, in this case we have 9 items, but may be other values.
on the Erel website
http://www.b4x.com:51042/json/index.html
the code dont parse correct, i think because the json code is bad formated
any help is welcome.
thank you
later many try*s i will request some help..
how can i parse this json result ?
{"success":true,"resultado":{"1":{"date":"29\/11\/2016 18:38","site":"CEE NOVO HAMBURGO - Novo Hamburgo\/RS","status":"Entrega Efetuada","isOrigin":true},"2":{"date":"29\/11\/2016 09:47","site":"Novo Hamburgo\/RS","status":"Saiu para entrega ao destinat\u00e1rio","isOrigin":true},"3":{"date":"28\/11\/2016 22:14","site":"CTE PORTO ALEGRE - Porto Alegre\/RS","status":"Encaminhado","isOrigin":true},"4":{"date":"28\/11\/2016 22:14","site":"Encaminhado para CEE NOVO HAMBURGO - Novo Hamburgo\/RS","status":"Encaminhado","isOrigin":false},"5":{"date":"25\/11\/2016 22:19","site":"CTE CAMPINAS - INDAIATUBA\/SP","status":"Encaminhado","isOrigin":true},"6":{"date":"25\/11\/2016 22:19","site":"Em tr\u00e2nsito para CTE PORTO ALEGRE - Porto Alegre\/RS","status":"Encaminhado","isOrigin":false},"7":{"date":"25\/11\/2016 18:01","site":"AC JUNDIAI - Jundiai\/SP","status":"Encaminhado","isOrigin":true},"8":{"date":"25\/11\/2016 18:01","site":"Encaminhado para UNIDADE DE CORREIOS\/BR","status":"Encaminhado","isOrigin":false},"9":{"date":"25\/11\/2016 13:01","site":"AC JUNDIAI - Jundiai\/SP","status":"Postado","isOrigin":true}},"Contador":9}
I know that json is badly formatted, but I have to find some solution to get the data as it is at the moment.
here is my last try code
B4X:
Select Job.JobName
Case "jobrastreio"
listaResultadoRastreio.Clear
Dim parser As JSONParser
parser.Initialize(Job.GetString)
Dim root As Map = parser.NextObject
Dim success As String = root.Get("success")
Dim Contador As Int = root.Get("Contador")
Dim resultado As Map = root.Get("resultado")
Log(resultado)
Log(resultado.Get("1"))
For i = 0 To Contador
Dim mm As Map = resultado.Get(i)
Log(mm.Size)
Dim date As String = mm.Get("date")
Dim site As String = mm.Get("site")
Dim isOrigin As String = mm.Get("isOrigin")
Dim status As String = mm.Get("status")
Log(status)
Next
but dont works, on the for i = 0 the map mm is not initialized.
thats is strange, because this look a map
{date=29/11/2016 18:38, site=CEE NOVO HAMBURGO - Novo Hamburgo/RS, status=Entrega Efetuada, isOrigin=true}
how can i parse this result?
ps: the result size is diferent
The result may be different always, in this case we have 9 items, but may be other values.
on the Erel website
http://www.b4x.com:51042/json/index.html
the code dont parse correct, i think because the json code is bad formated
any help is welcome.
thank you