Ver Mensaje Individual
  #1  
Viejo 03/02/12, 18:21:35
Array

[xs_avatar]
gohan0189 gohan0189 no está en línea
Miembro del foro
 
Fecha de registro: feb 2012
Mensajes: 190
Tu operador: TELCEL

deserializar json !!! ayudaaa

Tengo un web service que me manda una cadena json que es esta:

Código:
[{"StringProperty":"0","IntProperty":0,"DoubleProperty":0},{"StringProperty":"1","IntProperty":8,"DoubleProperty":53.98},{"StringProperty":"2","IntProperty":16,"DoubleProperty":107.96}]
y necesito deserializarlo en mi app pero no se como , me he guiado con algunos ejemplos de internet y he llegado a esto:

Código:
public void autor()     {                    SoapObject solicitud = new SoapObject(namespace, Metodo_getbookautor);           SoapSerializationEnvelope envoltorio = new SoapSerializationEnvelope(SoapEnvelope.VER11);           envoltorio.dotNet = true;           envoltorio.setOutputSoapObject(solicitud);           HttpTransportSE transporte = new HttpTransportSE(url);                      try {                 transporte.call(accionSoap_autor, envoltorio);                ///////////////                 Object result = (Object)envoltorio.getResponse();                                JSONString=result.toString();                try{                    jObject= new JSONObject(JSONString);                    jArray=jObject.getJSONArray("WebService");                    for (int i=0;i<jArray.length();i++)                    {                    JSONObject json_data= jArray.getJSONObject(i);                                        resultString= json_data.getString("StringProperty")+ " "                                 +json_data.getString("IntProperty")+ " "                                +json_data.getString("DoubleProperty");                    }                    }                catch (Exception e){                    e.printStackTrace();                }
pero cuando llega a jObject= new JSONObject(JSONString);
con debug jObject me da null y ya no hace lo demas, pero la verdad no se si eso este bien puesto que no se como es eso de la serializacion y deserializacion
Responder Con Cita