0

My problem is that I make a request in Android application which should return BigDecimal, instead, I got 2.0E7 value. I tried make this request in Postman and it returns 20000000 (proper value). I changed type of value in my data class to BigDecimal and to String and in both cases I got 2.0E7. I need to get the proper value. Can someone help in solving this issue?

Shishupal Shakya
  • 1,632
  • 2
  • 18
  • 41
Asset Bekbossynov
  • 1,633
  • 3
  • 13
  • 25

2 Answers2

0

You can use Long type for that (20000000).

In my project I am getting below json and I used long type in my model class

JSON

{
    "success": {
        "value": 20000000
    }
}

Models class

public class Success {

    @SerializedName("value")
    @Expose
    private Long value;

    public Long getValue() {
        return value;
    }

    public void setValue(Long value) {
        this.value = value;
    }

}
Divakar Murugesh
  • 1,207
  • 1
  • 10
  • 14
-1

Check this same question How to prevent Gson from converting a long number (a json string ) to scientific notation format?

This May help you...