Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Json problem
Message
Information générale
Forum:
Android
Catégorie:
Autre
Titre:
Divers
Thread ID:
01629711
Message ID:
01629713
Vues:
39
>Hi all, I'm trying to deserialize a Json string into a custom class
>
>
>public class Artist
>{
>    public Artist()
>    {
>        this.Albums = new ArrayList<Album>();
>    }
>
>    @SerializedName("artist")
>    String Artist;
>
>    @SerializedName("id")
>    String ID;
>
>    @Expose
>    ArrayList<Album> Albums = null;
>    
>
>    @Expose
>	String PlaceHolder = "";
>    }
>
>
>
>The problem I'm having is only the fields that are present in the Json string (id and artist ) are getting deserialized, what I want is for the other properties to be set to null which I will populate later. Any ideas ?

Not an answer to your question but if you are using this to retrieve data from a server you could take a look at Retrofit : http://square.github.io/retrofit/
Once set up it's simple to make async calls to the server and get back results already converted to Java objects (you can specify GSon as the converter)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform