Android - gson.fromJson没有正确分配一个字段

时间:2017-10-31 16:54:57

标签: android json gson

我有一个大约60个对象的json数组,每个对象有大约50个字段。当我使用fromJson时,它会将值准确地分配给除了一个以外的所有字段,"停止"。 "停止"正在充满了" -1"。这是"停止"的json字符串部分。以下是类片段。

"carrierid": "SG",
"stops": "0",
"seatsavailable": "1",

@SerializedName("carrierid")
@Expose
private String carrierid;
@SerializedName("stops")
@Expose
private String stops;
@SerializedName("seatsavailable")
@Expose
private String seatsavailable;

请让我知道我可能做错了什么。

{
 "data": {
  "returnflights": [
   {
    "origin": "TRV",
    "rating": 0,
    "DepartureTime": "",
    "flightcode": "3428",
    "Group": "",
    "farebasis": "LSAVER",
    "FlHash": "rSG-3428",
    "spicestatus": "Normal",
    "holdflag": "",
    "CINFO": "air-TRV-BLR-20171103--1-0-0-E-100--",
    "deptime": "17:20",
    "codeshare": "",
    "tickettype": "e",
    "ibibopartner": "spicejetnew",
    "productclass": "RS",
    "duration": "1h 35m",
    "platingcarrier": "",
    "qtype": "fbs",
    "carriercode": "SG",
    "flightno": "3428",
    "servicetype": "J",
    "fareclass": "L",
    "faresequence": "5",
    "destination": "BLR",
    "depterminal": "1",
    "carrierid": "SG",
    "stops": "0",
    "seatsavailable": "1",
    "state": "Clean",
    "arrterminal": "-",
    "provider": "",
    "PromotionId": "",
    "fare": {
     "grossamount": 5280,
     "totalbasefare": 4275,
     "adultbasefare": 4275,
     "totalfare": 5280,
     "totalsurcharge": 0,
     "totaltaxes": 1005,
     "adulttax": 1005,
     "adulttotalfare": 5280,
     "totalcommission": ""
    },
    "CabinClass": "",
    "fareapptype": "Route",
    "warnings": "Refundable",
    "ArrivalTime": "",
    "isallotmentmarketfare": "false",
    "onwardflights": [],
    "aircraftType": "DH8",
    "seatingclass": "E",
    "EticketFlag": "true",
    "faresellkey": "0~L~~LSAVER~2022~~5~X",
    "operatingcarrier": "",
    "std": "2017-11-03T17:20:00",
    "src": "",
    "sta": "2017-11-03T18:55:00",
    "ruleno": "2022",
    "splitduration": "1h 35m",
    "searchKey": "0:0:0:0:0:4275:0:5280:0:0:0:0:0:0:0:0:0:4275:5280:0:0:0:0:0:0",
    "bookingclass": "",
    "journeysellkey": "SG~3428~ ~~TRV~11/03/2017 17:20~BLR~11/03/2017 18:55~",
    "airline": "spicejet",
    "classofservice": "L",
    "multicitysearch": "",
    "depdate": "2017-11-03t1720",
    "arrtime": "18:55",
    "arrdate": "2017-11-03t1855",
    "TravelTime": ""
   },
   {
    "origin": "TRV",
    "rating": 0,
    "DepartureTime": "",
    "flightcode": "874",
    "Group": "",
    "farebasis": "T0IP",
    "FlHash": "r6E-874",
    "spicestatus": "Normal",
    "holdflag": "",
    "CINFO": "air-TRV-BLR-20171103--1-0-0-E-100--",
    "deptime": "07:50",
    "codeshare": "",
    "tickettype": "e",
    "ibibopartner": "indigonew",
    "productclass": "R",
    "duration": "1h 20m",
    "platingcarrier": "",
    "qtype": "fbs",
    "carriercode": "6E",
    "flightno": "874",
    "servicetype": "J",
    "fareclass": "T",
    "faresequence": "2",
    "destination": "BLR",
    "depterminal": "-",
    "carrierid": "6E",
    "stops": "0",
    "seatsavailable": "1",
    "state": "Clean",
    "arrterminal": "-",
    "provider": "",
    "PromotionId": "",
    "fare": {
     "grossamount": 3808,
     "totalbasefare": 2350,
     "adultbasefare": 2350,
     "totalfare": 3808,
     "totalsurcharge": 0,
     "totaltaxes": 1458,
     "adulttax": 1458,
     "adulttotalfare": 3808,
     "totalcommission": ""
    },
    "CabinClass": "",
    "fareapptype": "Route",
    "warnings": "Refundable",
    "ArrivalTime": "",
    "isallotmentmarketfare": "false",
    "onwardflights": [],
    "aircraftType": "320",
    "seatingclass": "E",
    "EticketFlag": "true",
    "faresellkey": "0~T~~T0IP~1059~~2~X",
    "operatingcarrier": "",
    "std": "2017-11-03T07:50:00",
    "src": "",
    "sta": "2017-11-03T09:10:00",
    "ruleno": "1059",
    "splitduration": "1h 20m",
    "searchKey": "0:0:0:0:0:2350:0:3808:0:0:0:0:0:0:0:0:0:2350:3808:0:0:0:0:0:0",
    "bookingclass": "",
    "journeysellkey": "6E~ 874~ ~~TRV~11/03/2017 07:50~BLR~11/03/2017 09:10~",
    "airline": "Indigo",
    "classofservice": "T",
    "multicitysearch": "",
    "depdate": "2017-11-03t0750",
    "arrtime": "09:10",
    "arrdate": "2017-11-03t0910",
    "TravelTime": ""
   }
  ]
 },
 "data_length": 2
}

0 个答案:

没有答案