Hi guys,
i’ve read lot of threads but i cannot understand how to do this :
I receive a JSON from an API in this format :
{
"lista_clienti": [
{
"id": "111111",
"nome": "XXXXXX",
"referente": "",
"indirizzo_via": "XXXXX",
"indirizzo_cap": "XXXXXX",
"indirizzo_citta": "XXXXXX",
"indirizzo_provincia": "XXXXXX",
"indirizzo_extra": "",
"paese": "XXXXXX",
"mail": "",
"tel": "",
"fax": "282",
"piva": "XXXXXX",
"cf": "",
"termini_pagamento": "0",
"pagamento_fine_mese": false,
"val_iva_default": "",
"desc_iva_default": "",
"extra": "",
"PA": false
},
{
"id": "1234456",
"nome": "XXXXXX",
"referente": "",
"indirizzo_via": "XXXXXX",
"indirizzo_cap": "XXXXXX",
"indirizzo_citta": "XXXXXX",
"indirizzo_provincia": "XXXXXX",
"indirizzo_extra": "",
"paese": "XXXXXX",
"mail": "",
"tel": "",
"fax": "701",
"piva": "XXXXXX",
"cf": "",
"termini_pagamento": "0",
"pagamento_fine_mese": false,
"val_iva_default": "",
"desc_iva_default": "",
"extra": "",
"PA": false
}
],
"pagina_corrente": 1,
"numero_pagine": 1,
"success": true
}
As you can see the JSON has an array lista_clienti and 3 values pagina_corrente , numero_pagine and success.
I can easely access the 3 values but i cannot understand how to access the array nested in lista_clienti.
Here is the code i wrote :
Dim i As Integer
Dim e As Xojo.Core.Dictionary
Dim d as Xojo.Core.Dictionary
// Display the results
Dim jsonData As Text = Xojo.Core.TextEncoding.UTF8.ConvertDataToText(Content)
d = Xojo.Data.ParseJSON(jsonData)
if d.value("success") then
Msgbox "OK!"
//HERE I SHOULD ENTER INSIDE THE ARRAY AND COPY THE CONTENT IN A LISTBOX
else
Msgbox "ERROR"
end if
I tried with an array declared as Auto but it remains always empty and i don’t know how to populate it.
Thanks
Mattia