java - GSON Deserialization to an ArrayList not working -
I have an ArrayList (Tweet is one class I defined in my package) of objects. Now, I wrote this Arrayist using a GSON in a file as a JSN object. Going forward, I am now reading JSN Object in an Arrayist using the GSOn. However, when I recapture through this newly recited Arrayist, I can not bring it back to the Color object. Although the ArrayList is actually a collection of tweeted objects, the exceptions I get are: com.google.gson.internal.LinkedTreeMap can not be inserted into the tweet contents_array_tweets is a protection of the tweet objects contents_array has also been declared as the array list of the Tweet Object. Here is the code:
f.write_file ("Content_Array_JSON_full.json", GS.N. TOGSON (O.Contents_Are_tsits), false); Ob.read_file ("Content_Array_JSON_full.json", f); Ob.contents_array = gson.from Jason (ob.file_contents, ArrayList.class); For (i = 0; i
ob.contents_array = gson.fromJson (ob.file_contents, ArrayList) .quo;); Instead of a raw
array list.clus you should use the exact runtime type of airlist type parameter to tell about GSL:
ob. CONTACTS_ARE = GSN.Frame Jason (Ob.File_Contents, New Typokan & lt; Heret & lt; tweet & gt; & gt; {}}} GetType ();;
Comments
Post a Comment