HTTPUtils2 and JSON

wizard699

Active Member
Licensed User
Longtime User
Hi.
I've a .NET web service that return a JSON in this format

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">{"Table1":[{"ID":1,"NumCertificato":"39366169","CodiceFiscale":"DDDFFFFFFS","Cognome":"GESSONI","Nome":"PETER","NatoIl":"07/06/1979","Sesso":"M","ProvNascita":"BA","ComuneNascita":"BARI","ViaResidenza":"VIA M. ZIZZO, 39","ProvResidenza":"BA","ComuneResidenza":"BARI","CAPResidenza":"70124","CORep":"","ViaRep":"","ProvRep":"","ComuneRep":"","CAPRep":"","DataInizio":"16/11/2012","DataFine":"16/11/2012","DataCertificato":"16/11/2012","Diagnosi1":"","Diagnosi2":"","TipoVisita":"INIZIO","TipoCertificato":"","CodNosologico":"","CognomeMedico":"FRANTONIO","NomeMedico":"VINCENZO","RegASL":"999","ASL":"444"}]}</string>

To obtain this result I use this code

B4X:
job2.Initialize("Job2", Me)
job2.PostString("http://URL", "parameter1=EEEDDDEEEE")

and then in Sub JobDone

B4X:
Log(Job.GetString)

yo view in the Log window the response.


Now .... if I use in JobDone this code

B4X:
Dim JSON As JSONParser
Dim List1 As List
JSON.Initialize( Job.GetString) 'Read the text 
List1 = JSON.NextArray

i've an error of invalid json.

Someone can help me to parse the output that i show above?

Thanks
 
Top