Category : gson

I’m making cryptocurrency information viewer now. I use Retrofit to get response, but have some problem. https://api.coinone.co.kr/ticker/?currency=all This is the api I use. and its structure is… too complicated to make pojo class. if I make convert this to pojo class, then pojo class will be like data class Coinone( val result: String, val errorCode: ..

Read more

Class parent{ //parent atrribute and getter setter and constructors List<children> child; } class children{ // children attribute and getter setter and constructors } I have two classes parent class 2 lists of children’s class. 1 class as a parent which attributes is name, id, address, 2 class children, where child name, class name, school name, ..

Read more

I doing serialization Gson().toJson(objOfClass). but I need to set SEQ,& SRC property before the DEVAWSEP so how could I set it? {"state":{"desired":{"ACT":1,"DEVAWSEP":"xxxxxxxxx","SEQ":6048799,"SRC":"MA"}}} I want this form {"state":{"desired":{"ACT":1,"SEQ":6048799,"SRC":"MA","DEVAWSEP":"xxxxxxxxx"}}} so I want to do to serialization without alphabet order I m use this library. dependencies { implementation ‘com.google.code.gson:gson:2.8.6’ } Source: Android..

Read more

I am working on game that has some effects while playing public enum Effect { DoublePoints(), IncreaseSwitch(), ShowOne(), ShowSame(); @SerializedName("stored") int stored; @SerializedName("leftTime") int leftTime; Effect() { } public int getStored() { return stored; } public void setStored(int stored) { this.stored = stored; } public int getLeftTime() { return leftTime; } public void setLeftTime(int leftTime) ..

Read more

I had use the data transfer of object by using Gson but getting the empty string My proguard -keepattributes Signature # Gson specific classes -keep class sun.misc.Unsafe { *; } #-keep class com.google.gson.stream.** { *; } -keep class com.google.gson.** { *; } # Application classes that will be serialized/deserialized over Gson -keep class com.modelcalsspath.* { ..

Read more

I’m using it with Gson in the following way: private void saveData(ArrayList<Contacts> arrayListContact) { SharedPreferences sharedPreferences = getSharedPreferences("shared preferences", MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); Gson gson = new Gson(); String json = gson.toJson(arrayListContact); editor.putString("contact list", json); editor.apply(); } Let’s suppose that I want to remove a contact {&quot;contactImageId&quot;:2131165342,&quot;contactName&quot;:&quot;test&quot;,&quot;contactNumber&quot;:&quot;1&quot;} by searching for the contactNumber. How can ..

Read more