Android JSON/GSON deserialization problem?

The output of the following example is link=

, link=
, link=
public class Foo { static String jsonInput = "{" + "\"images\":" + "" + "{" + "\"link\":\"
\"" + "}," + "{" + "\"link\":\"
\"" + "}," + "{" + "\"link\":\"
\"" + "}" + "" + "}"; public static void main(String args) { GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder. SetFieldNamingPolicy(FieldNamingPolicy. LOWER_CASE_WITH_UNDERSCORES); Gson gson = gsonBuilder.create(); ImageUris uris = gson.

FromJson(jsonInput, ImageUris. Class); System.out. Println(uris); } } class ImageUris { private ImageUri images; @Override public String toString() { return Arrays.

ToString(images); } } class ImageUri { private String link; @Override public String toString() { return "link=" + link; } }.

I am trying od deserialize the following JSON part with GSON. If GSON gets this JSON string, GSON crashes. If there is only one item in "images" it works great.

How can I fix that problem? Sometimes I get only one "link" in JSON and sometimes there are three entries in JSON like above. How can I handle this JSON with GSON?

Thanks a lot in advance!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions