GsonFormat原来也有bug
我是用GsonFormat来生成java bean的,但是运行起来居然报
Caused by: java.lang.NumberFormatException: Expected an int but was 4.5 at line 58 column 25 path $.list[4].stars
原来,它生成javabean是一个int型,但是获取到的居然有int,也有float
javabean如下
public static class ListBean { private int id;
private String name;
private String packageName;
private String iconUrl;
private float stars;
private int size;
private String downloadUrl;
private String des;
我改成float了。
数据中star有整型也有float型的:
{
"id": 1631363,
"name": "鐢锋€х浜哄尰鐢�",
"packageName": "com.medapp.man",
"iconUrl": "app/com.medapp.man/icon.jpg",
"stars": 4,
"size": 1979701,
"downloadUrl": "app/com.medapp.man/com.medapp.man.apk",
"des": "鐢锋€х浜哄尰鐢熸槸涓€娆句笓闂ㄩ拡瀵圭敺鎬х敓鐞嗗仴搴蜂互鍙婂叾浠栫浉鍏充笓绉戠梾鐥囨彁渚涘厤璐瑰湪绾垮挩璇㈢殑鍖荤枟"
},
{
"id": 1637000,
"name": "绗戦湼鏉ヤ簡(涓栫晫鏉増)",
"packageName": "com.zuobao.xiaobao",
"iconUrl": "app/com.zuobao.xiaobao/icon.jpg",
"stars": 4.5,
"size": 4365674,
"downloadUrl": "app/com.zuobao.xiaobao/com.zuobao.xiaobao.apk",
"des": "灏辩畻鐢熸椿鍐嶈嫤閫硷紝鎴戜滑浠嶉渶灏忓揩涔愶紒绗戦湼鏉ヤ簡锛岀粰浣犱笉涓€鏍风殑蹇箰銆傜嫭涔愪箰锛屼笉濡備紬涔愪箰銆�"
},