无法将字符串Json解析为Json对象

时间:2018-08-12 09:41:20

标签: android json gson

我有json值[“ SelectedRoute”],它是json的字符串。其中双引号替换为 \“

"SelectedRoute": "{\"bounds\":{\"northeast\":{\"lat\":23.8762034,\"lng\":90.4259529},\"southwest\":{\"lat\":23.7500263,\"lng\":90.3785006}},\"copyrights\":\"Map data ©2018 Google\",\"legs\":[{\"distance\":{\"text\":\"21.5 km\",\"value\":21509},\"duration\":{\"text\":\"1 hour 0 mins\",\"value\":3600},\"end_address\":\"Rd No 17B, Dhaka 1230, Bangladesh\",\"end_location\":{\"lat\":23.8758733,\"lng\":90.379545499999992},\"start_address\":\"13 Kazi Nazrul Islam Ave, Dhaka 1215, Bangladesh\",\"start_location\":{\"lat\":23.7509919,\"lng\":90.3929052},\"steps\":[{\"distance\":{\"text\":\"0.1 km\",\"value\":116},\"duration\":{\"text\":\"1 min\",\"value\":46},\"end_location\":{\"lat\":23.7500263,\"lng\":90.3933254},\"html_instructions\":\"Head <b>south</b>\",\"polyline\":{\"points\":\"uz}oCuzufPREJCJERGTKVKZMt@U\"},\"start_location\":{\"lat\":23.7509919,\"lng\":90.3929052},\"travel_mode\":\"DRIVING\",\"maneuver\":null},{\"distance\":{\"text\":\"0.8 km\",\"value\":848},\"duration\":{\"text\":\"4 mins\",\"value\":231},\"end_location\":{\"lat\":23.753581,\"lng\":90.4005655},\"html_instructions\":\"At the roundabout, take the <b>1st</b> exit onto <b>Panthapath Tejgaon link Rd</b>\",\"polyline\":{\"points\":\"ut}oCi}ufP@?Iu@EWKi@YsAaAqFMa@WaAIUQm@GWUm@Wq@Wm@Wm@Wk@Wg@q@kAuA}BaDuFUa@QQQSSQ\"},\"start_location\":{\"lat\":23.7500263,\"lng\":90.3933254},\"travel_mode\":\"DRIVING\",\"maneuver\":\"roundabout-left\"},{\"distance\":{\"text\":\"0.4 km\",\"value\":404},\"duration\":{\"text\":\"1 min\",\"value\":57},\"end_location\":{\"lat\":23.7568788,\"lng\":90.3989307},\"html_instructions\":\"Turn <b>left</b> onto <b>Moghbazar Rd</b>/<b>Shaheed Tajuddin Ahmed Ave</b>\",\"polyline\":{\"points\":\"{j~oCqjwfPMHk@ZUJiAl@SJ_@P_@Na@Na@NMBGBOBODIBMBKBSFKFYLIDWLOFWJ[LUJOFIBKBMBE@WD\"},\"start_location\":{\"lat\":23.753581,\"lng\":90.4005655},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-left\"},{\"distance\":{\"text\":\"0.3 km\",\"value\":337},\"duration\":{\"text\":\"2 mins\",\"value\":95},\"end_location\":{\"lat\":23.7558643,\"lng\":90.4018631},\"html_instructions\":\"Sharp <b>right</b> onto <b>Hatir Jheel Link Rd</b>\",\"polyline\":{\"points\":\"o__pCi`wfPM@AYJ?HOFIBIDIDODQP}@XgAt@mCDIBMDIBOFWHc@Jm@Rq@\"},\"start_location\":{\"lat\":23.7568788,\"lng\":90.3989307},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-sharp-right\"},{\"distance\":{\"text\":\"0.2 km\",\"value\":161},\"duration\":{\"text\":\"1 min\",\"value\":25},\"end_location\":{\"lat\":23.7567087,\"lng\":90.4030281},\"html_instructions\":\"At the roundabout, take the <b>1st</b> exit and stay on <b>Hatir Jheel Link Rd</b>\",\"polyline\":{\"points\":\"cy~oCsrwfPAAA?A??AA??AA??AAAAA?A?AA??A?A?A?A?A?A?A?A?A@A?A@A?AOMIIKIEIGIIOIOK[GOGQCICECCCAEEEAIESG\"},\"start_location\":{\"lat\":23.7558643,\"lng\":90.4018631},\"travel_mode\":\"DRIVING\",\"maneuver\":\"roundabout-left\"},{\"distance\":{\"text\":\"1.1 km\",\"value\":1119},\"duration\":{\"text\":\"2 mins\",\"value\":112},\"end_location\":{\"lat\":23.7640589,\"lng\":90.410230800000008},\"html_instructions\":\"Keep <b>left</b> to stay on <b>Hatir Jheel Link Rd</b>\",\"polyline\":{\"points\":\"m~~oC}ywfPa@K}@Ma@Gi@MYM]OWKCCCAoAkAc@c@IIEIMSYg@OYGIGIQUo@u@EG{@_BKSa@w@QY_@q@Wc@]e@W]OQWW{BwBe@c@GG[YMMOMKKuCcDGIq@q@AAuA_AeA}@u@m@\"},\"start_location\":{\"lat\":23.7567087,\"lng\":90.4030281},\"travel_mode\":\"DRIVING\",\"maneuver\":\"keep-left\"},{\"distance\":{\"text\":\"1.3 km\",\"value\":1262},\"duration\":{\"text\":\"3 mins\",\"value\":162},\"end_location\":{\"lat\":23.7710032,\"lng\":90.412744400000008},\"html_instructions\":\"Continue straight\",\"polyline\":{\"points\":\"kl`pC}fyfP_@U[UWS_@Wc@USGWI{@QIAMCO?G?C?E@KDQJQLSRq@l@SVMP_@j@KV]r@Wn@CFKPMNMHg@d@SPKLIFEDGBE@c@Jm@HKBOBI?K?MAKAICCAQKMIKKOQQUEMGQEMC[C]Ag@?e@Da@Ha@BMJULULYDQDKFi@@Y?SAW?IAIC_@E]AGCMCEGSIKSMMIIEQIKEw@YMGSGKCMCKAi@EgASI?KAI?u@Ac@A\"},\"start_location\":{\"lat\":23.7640589,\"lng\":90.410230800000008},\"travel_mode\":\"DRIVING\",\"maneuver\":\"straight\"},{\"distance\":{\"text\":\"0.4 km\",\"value\":375},\"duration\":{\"text\":\"1 min\",\"value\":59},\"end_location\":{\"lat\":23.7726206,\"lng\":90.415847},\"html_instructions\":\"Slight <b>right</b> onto <b>Hatir Jheel Link Rd 5</b>\",\"polyline\":{\"points\":\"wwapCsvyfPCWKAMEQGSQMKKKGIIO]u@[{@g@{A]iA{@gCGYEUESC]\"},\"start_location\":{\"lat\":23.7710032,\"lng\":90.412744400000008},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-slight-right\"},{\"distance\":{\"text\":\"0.4 km\",\"value\":366},\"duration\":{\"text\":\"1 min\",\"value\":57},\"end_location\":{\"lat\":23.771775,\"lng\":90.4185292},\"html_instructions\":\"<b>Hatir Jheel Link Rd 5</b> turns slightly <b>right</b> and becomes <b>Hatir Jheel Link Rd</b>\",\"polyline\":{\"points\":\"{abpCajzfP?KNe@Jk@?M?GCKEIMUIOKOUa@GMCIEKAGAGAOAU?E@UBYDQBIBIFMBGFGDEDCNKRKpBs@^K\"},\"start_location\":{\"lat\":23.7726206,\"lng\":90.415847},\"travel_mode\":\"DRIVING\",\"maneuver\":null},{\"distance\":{\"text\":\"0.6 km\",\"value\":639},\"duration\":{\"text\":\"2 mins\",\"value\":90},\"end_location\":{\"lat\":23.7702073,\"lng\":90.4236367},\"html_instructions\":\"Keep <b>right</b> to continue on <b>হাতির ঝিল সংযোগ সড়ক</b>\",\"polyline\":{\"points\":\"s|apCyzzfP\\\\GTGHEFEDEHGV]^i@HSJSDKFMBMBQFWFm@B]@O@Q?YCa@Ec@EWI[GMGKGIECKGKGECGGGGEEGSCK?M?KDUBKDMHK`Au@PSh@o@d@w@FUH_@Hm@@IBS?S\"},\"start_location\":{\"lat\":23.771775,\"lng\":90.4185292},\"travel_mode\":\"DRIVING\",\"maneuver\":\"keep-right\"},{\"distance\":{\"text\":\"3.2 km\",\"value\":3190},\"duration\":{\"text\":\"13 mins\",\"value\":766},\"end_location\":{\"lat\":23.7976518,\"lng\":90.423476},\"html_instructions\":\"At the roundabout, take the <b>1st</b> exit onto <b>Bir Uttam Rafiqul Islam Ave</b>\",\"polyline\":{\"points\":\"yrapCwz{fPFa@BYA_@EUAC?ACEAEACACAC?CAC?C?C?A@EBGeAg@o@U}@_@gBo@GC}A_@YGSE]EKAiCQmAKeBMy@IEAECCACCKECCMCa@CWAm@Au@@W@[@C?OBe@H[H]FQ@oFP[@S@c@Bq@DgADo@DO@Q@M?S@[?w@AKA[?k@C[A}@CC?O?a@CgAAcBMmAGgAEw@AmBG}@@sAAo@?mAFA?iCVcBNk@BKBI@cBJaCPq@FyGl@gAL}ANaBPwDb@{D`@sMtAqANiEj@o@FcEd@oAHW@\"},\"start_location\":{\"lat\":23.7702073,\"lng\":90.4236367},\"travel_mode\":\"DRIVING\",\"maneuver\":\"roundabout-left\"},{\"distance\":{\"text\":\"3.2 km\",\"value\":3210},\"duration\":{\"text\":\"9 mins\",\"value\":541},\"end_location\":{\"lat\":23.8256119,\"lng\":90.4215735},\"html_instructions\":\"Continue onto <b>Progati Sarani Rd</b>\",\"polyline\":{\"points\":\"i~fpCwy{fPSB}BTM@cJhA{QtBcIpA}@JyBXcCVkBN}Ff@}@FsAFo@BA?i@?I?G?]As@@iBDqGNM?u@BeJNoA@c@A]?iBB}DFWAcA@w@?yA@U@Q@UBa@DSBWB{@Hs@Lu@PwBv@uAh@g@Rg@XOH[LYJYPOFSBS@G?E@IASEMEUI[Uc@[g@_@]SUMWMQIWKgA_@g@Qa@Mo@Oo@M_AKkAGoAIu@I_@OIGKGOSIOCM\"},\"start_location\":{\"lat\":23.7976518,\"lng\":90.423476},\"travel_mode\":\"DRIVING\",\"maneuver\":null},{\"distance\":{\"text\":\"76 m\",\"value\":76},\"duration\":{\"text\":\"1 min\",\"value\":11},\"end_location\":{\"lat\":23.8250745,\"lng\":90.4218806},\"html_instructions\":\"Keep <b>right</b> to continue toward <b>Tongi Diversion Rd</b>/<b>N3</b>\",\"polyline\":{\"points\":\"amlpCym{fPFSJONQHGDCHAHAJ@VD\"},\"start_location\":{\"lat\":23.8256119,\"lng\":90.4215735},\"travel_mode\":\"DRIVING\",\"maneuver\":\"keep-right\"},{\"distance\":{\"text\":\"3.9 km\",\"value\":3884},\"duration\":{\"text\":\"6 mins\",\"value\":361},\"end_location\":{\"lat\":23.8502645,\"lng\":90.4085231},\"html_instructions\":\"Keep <b>left</b> at the fork and merge onto <b>Tongi Diversion Rd</b>/<b>N3</b><div style=\\\"font-size:0.9em\\\">Continue to follow N3</div>\",\"polyline\":{\"points\":\"uilpCwo{fP~@TPLLFRH^FfCFB?tDJJ@HBLDJDFHNPJRDPBTA^It@Ir@KVKPKJKHSHG@I@K@I?M?EAQCo@QYIw@SgAOQAmAKqAIy@OY?U?c@B]By@Fs@FkALg@Fa@B_E^wD\\\\gWfCaAH{E^{Gn@q@JiAPaATiDt@u@PoA\\\\_AX_A^cAb@oBdAyAx@kAr@qA|@uB|A{BhBs@h@g@^sDtC_FzDoDrC[Vu@j@IFmCrByB`BqAdAeBrAoAbAYTk@b@cCpBqBfB\"},\"start_location\":{\"lat\":23.8250745,\"lng\":90.4218806},\"travel_mode\":\"DRIVING\",\"maneuver\":\"fork-left\"},{\"distance\":{\"text\":\"2.2 km\",\"value\":2245},\"duration\":{\"text\":\"5 mins\",\"value\":304},\"end_location\":{\"lat\":23.8677906,\"lng\":90.4001691},\"html_instructions\":\"At the roundabout, take the <b>2nd</b> exit onto <b>Dhaka - Mymensingh Hwy</b>/<b>N3</b>\",\"polyline\":{\"points\":\"cgqpCg|xfP?@?B?BAB?B?BA@ABABA@ABC@A@A@C@C@A?C@C?C?A?C??AA?A?A?AAA?CACEQRkA|@qAbA{BdBwDtC{DzCgDfCIFc@`@uC|ByErDsB~A}D~C}AfAWR[TeChBi@^k@\\\\WLEBQH[LYLMD]DOBs@H{AP{@Fo@BcA@}BE{CIe@?[Aa@AmACUAsEM_AAqGS\"},\"start_location\":{\"lat\":23.8502645,\"lng\":90.4085231},\"travel_mode\":\"DRIVING\",\"maneuver\":\"roundabout-left\"},{\"distance\":{\"text\":\"0.6 km\",\"value\":646},\"duration\":{\"text\":\"2 mins\",\"value\":136},\"end_location\":{\"lat\":23.8672733,\"lng\":90.393847},\"html_instructions\":\"Turn <b>left</b> onto <b>Rabindra Sarani</b>\",\"polyline\":{\"points\":\"uttpCahwfP@XHhBFnAV|FDdAF`BBzAVnG@NLdC@bB?N\"},\"start_location\":{\"lat\":23.8677906,\"lng\":90.4001691},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-left\"},{\"distance\":{\"text\":\"0.2 km\",\"value\":238},\"duration\":{\"text\":\"1 min\",\"value\":47},\"end_location\":{\"lat\":23.8694011,\"lng\":90.3937818},\"html_instructions\":\"Turn <b>right</b> onto <b>Lake Dr Rd</b>/<b>Road No 16</b>\",\"polyline\":{\"points\":\"mqtpCq`vfPKDE@KBS@mCAiF@\"},\"start_location\":{\"lat\":23.8672733,\"lng\":90.393847},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-right\"},{\"distance\":{\"text\":\"1.0 km\",\"value\":995},\"duration\":{\"text\":\"3 mins\",\"value\":166},\"end_location\":{\"lat\":23.869254,\"lng\":90.384},\"html_instructions\":\"Turn <b>left</b> onto <b>Gausul Azam Ave</b>\",\"polyline\":{\"points\":\"w~tpCc`vfP?\\\\?F?p@DlF?L?pA@X@rB?V@pBBxIBvFF|I@zD?dA?r@\"},\"start_location\":{\"lat\":23.8694011,\"lng\":90.3937818},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-left\"},{\"distance\":{\"text\":\"0.5 km\",\"value\":549},\"duration\":{\"text\":\"2 mins\",\"value\":111},\"end_location\":{\"lat\":23.8741914,\"lng\":90.3838579},\"html_instructions\":\"Turn <b>right</b> onto <b>Shah Makhdum Ave</b>\",\"polyline\":{\"points\":\"y}tpC_ctfPK?iORmD@}A@aB?wAB\"},\"start_location\":{\"lat\":23.869254,\"lng\":90.384},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-right\"},{\"distance\":{\"text\":\"0.4 km\",\"value\":428},\"duration\":{\"text\":\"2 mins\",\"value\":90},\"end_location\":{\"lat\":23.8740955,\"lng\":90.3796571},\"html_instructions\":\"Turn <b>left</b> onto <b>Sonargaon Janapath</b>\",\"polyline\":{\"points\":\"u|upCcbtfPArA?b@D~KDzC@hBD\\\\?J\"},\"start_location\":{\"lat\":23.8741914,\"lng\":90.3838579},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-left\"},{\"distance\":{\"text\":\"0.1 km\",\"value\":141},\"duration\":{\"text\":\"1 min\",\"value\":40},\"end_location\":{\"lat\":23.8744586,\"lng\":90.3785946},\"html_instructions\":\"Turn <b>right</b> onto <b>Noyanogor Rd</b>\",\"polyline\":{\"points\":\"c|upC{gsfPJFHHBDYFKDMHMNKPGPENARAn@A\\\\\"},\"start_location\":{\"lat\":23.8740955,\"lng\":90.3796571},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-right\"},{\"distance\":{\"text\":\"0.2 km\",\"value\":208},\"duration\":{\"text\":\"1 min\",\"value\":64},\"end_location\":{\"lat\":23.8761437,\"lng\":90.379075899999989},\"html_instructions\":\"Turn <b>right</b>\",\"polyline\":{\"points\":\"k~upCeasfP?P_AAO?IAIAaA]_@Oy@YoAe@\"},\"start_location\":{\"lat\":23.8744586,\"lng\":90.3785946},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-right\"},{\"distance\":{\"text\":\"72 m\",\"value\":72},\"duration\":{\"text\":\"1 min\",\"value\":29},\"end_location\":{\"lat\":23.8758733,\"lng\":90.379545499999992},\"html_instructions\":\"Turn <b>right</b><div style=\\\"font-size:0.9em\\\">Destination will be on the right</div>\",\"polyline\":{\"points\":\"{hvpCgdsfPKEFO\\\\{@@??@@?@@@?@?@?@?@?@??A@?@??A@??A@A?A?A@??A?A\"},\"start_location\":{\"lat\":23.8761437,\"lng\":90.379075899999989},\"travel_mode\":\"DRIVING\",\"maneuver\":\"turn-right\"}],\"traffic_speed_entry\":[],\"via_waypoint\":[]}],\"overview_polyline\":{\"points\":\"uz}oCuzufP~@Wl@WpAc@Gu@QaA{AeIe@cBy@iC_ByDiAsBwFsJg@s@e@e@yC~AuB|@gAZs@P_DrA{@Zy@LAYJ?PYTu@j@eCz@wCT_ATqAPs@EAEIASBEYYQSQYe@mAOUi@Ua@K}@MkAUsAm@aC{B}@_BqA_BoBsDq@kAu@iAg@o@sCoCwAsAyDgEs@s@uA_AeA}@uAcAs@i@cAm@k@QeAS]C]Fc@XeA`Aa@h@k@bAeA|BwApAc@^cBZs@@UEUMYUa@g@M_@Ii@EeADgALo@Xk@Rk@Lu@@m@Aa@MoAGSQ_@}@g@eBo@oAOqASUAyACCWKA_@Ma@]SUg@eAcAwCyAqEMo@Iq@Nq@Jk@?MCSS_@s@oAMe@Ce@@[Hk@FSXc@TOdC_A|@S^MLK`@e@h@}@P_@J[Ji@NmBC{@K{@Qi@OUc@WOOMYCYDa@HYjAaAz@cAd@w@FURmAD]Fu@@y@Ka@GQAO@GBGeAg@mBu@oBs@wBg@q@KiIm@_AKIEa@Qy@EcB?gAFqB\\\\cIXyDRoABkCGmBEiBEqDU_CGmBG}@@cCAoAFeHn@aHf@aJz@_E`@y[jDyFr@sGn@wD\\\\cJhA{QtBaK|A}Fp@iJv@qCNq@ByAA}LV{KRsB?}IHkFD}ANsALs@Lu@PmE`BoAl@k@Vs@\\\\OFg@DM@]Gc@O_Aq@eAs@m@[yCgAqA]oBY{CQu@I_@OUOYc@CMFSZa@NKRCb@F~@TPL`@P^FfCFxDJTDXJVZPd@@t@ShBWh@WT[JUBW?aBa@w@SgAO_BMqAIy@Oo@?aAFmBNuIx@_]dD}Gh@mIz@kCf@_FfAoCv@cCbAiE~B}CpBqFfEoNzKkG~E_MnJyGnFqBhB?FCLGLKFW@GAEACEQR}C`CsHzFqKlIaTpPwGzEuA|@]PuAj@}Dd@kBJcA@}BEaEI}@CwJUqGS@XPxD\\\\bIJ|DX~GLdC@bB?NKDQDaD?iF@?\\\\?x@DzFBvFP``@@`G?r@K?wTT_E@wABArADbMFdGDh@TPBDYFYNY`@M`@CbAAn@oAASCaBm@iC_AKEFO^{@@@B@H?BABG@E\"},\"summary\":\"Bir Uttam Rafiqul Islam Ave and N3\",\"warnings\":[],\"waypoint_order\":[]}"

Pastbin link for full json view

我有Gson库。 现在无法转换为Json对象来解析它。 为了解析,我需要替换该String中的所有反斜杠。 如何替换其中的所有反斜杠。

这是我的数据模型类

import java.util.List;
import com.google.gson.annotations.SerializedName;


public class DriverMyTripDataItem{
/**   job id     */
@SerializedName("Id")
private int id;

@SerializedName("DestinationLat")
private double destinationLat;

@SerializedName("IsRouteSelected")
private boolean isRouteSelected;

@SerializedName("DestinationLng")
private double destinationLng;

@SerializedName("StartTime")
private String startTime;

@SerializedName("EstimatedCost")
private double estimatedCost;

@SerializedName("VehicleId")
private int vehicleId;

@SerializedName("SourceName")
private String sourceName;

@SerializedName("SeatPlanJson")
private List<SeatPlanJsonItem> seatPlanJson;

@SerializedName("IsJobCancelled")
private boolean isJobCancelled;

@SerializedName("IsJobStarted")
private boolean isJobStarted;

@SerializedName("DriverId")
private String driverId;

@SerializedName("SourceLat")
private double sourceLat;

@SerializedName("Eta")
private double eta;

@SerializedName("IsJobCompleted")
private boolean isJobCompleted;

@SerializedName("TotalSeatBookingRequest")
private int totalSeatBookingRequest;

@SerializedName("DestinationName")
private String destinationName;

@SerializedName("SelectedRoute")
private Object selectedRoute;



@SerializedName("SourceLng")
private double sourceLng;

@SerializedName("EstimatedFuelConsumption")
private double estimatedFuelConsumption;

@SerializedName("JobCancellReason")
private Object jobCancellReason;

public void setDestinationLat(double destinationLat){
    this.destinationLat = destinationLat;
}

public double getDestinationLat(){
    return destinationLat;
}

public void setIsRouteSelected(boolean isRouteSelected){
    this.isRouteSelected = isRouteSelected;
}

public boolean isIsRouteSelected(){
    return isRouteSelected;
}

public void setDestinationLng(double destinationLng){
    this.destinationLng = destinationLng;
}

public double getDestinationLng(){
    return destinationLng;
}

public void setStartTime(String startTime){
    this.startTime = startTime;
}

public String getStartTime(){
    return startTime;
}

public void setEstimatedCost(double estimatedCost){
    this.estimatedCost = estimatedCost;
}

public double getEstimatedCost(){
    return estimatedCost;
}

public void setVehicleId(int vehicleId){
    this.vehicleId = vehicleId;
}

public int getVehicleId(){
    return vehicleId;
}

public void setSourceName(String sourceName){
    this.sourceName = sourceName;
}

public String getSourceName(){
    return sourceName;
}

public void setSeatPlanJson(List<SeatPlanJsonItem> seatPlanJson){
    this.seatPlanJson = seatPlanJson;
}

public List<SeatPlanJsonItem> getSeatPlanJson(){
    return seatPlanJson;
}

public void setIsJobCancelled(boolean isJobCancelled){
    this.isJobCancelled = isJobCancelled;
}

public boolean isIsJobCancelled(){
    return isJobCancelled;
}

public void setIsJobStarted(boolean isJobStarted){
    this.isJobStarted = isJobStarted;
}

public boolean isIsJobStarted(){
    return isJobStarted;
}

public void setDriverId(String driverId){
    this.driverId = driverId;
}

public String getDriverId(){
    return driverId;
}

public void setSourceLat(double sourceLat){
    this.sourceLat = sourceLat;
}

public double getSourceLat(){
    return sourceLat;
}

public void setEta(double eta){
    this.eta = eta;
}

public double getEta(){
    return eta;
}

public void setIsJobCompleted(boolean isJobCompleted){
    this.isJobCompleted = isJobCompleted;
}

public boolean isIsJobCompleted(){
    return isJobCompleted;
}

public void setTotalSeatBookingRequest(int totalSeatBookingRequest){
    this.totalSeatBookingRequest = totalSeatBookingRequest;
}

public int getTotalSeatBookingRequest(){
    return totalSeatBookingRequest;
}

public void setDestinationName(String destinationName){
    this.destinationName = destinationName;
}

public String getDestinationName(){
    return destinationName;
}

public void setSelectedRoute(Object selectedRoute){
    this.selectedRoute = selectedRoute;
}

public Object getSelectedRoute(){
    return selectedRoute;
}

public void setId(int id){
    this.id = id;
}

public int getId(){
    return id;
}

public void setSourceLng(double sourceLng){
    this.sourceLng = sourceLng;
}

public double getSourceLng(){
    return sourceLng;
}

public void setEstimatedFuelConsumption(double estimatedFuelConsumption){
    this.estimatedFuelConsumption = estimatedFuelConsumption;
}

public double getEstimatedFuelConsumption(){
    return estimatedFuelConsumption;
}

public void setJobCancellReason(Object jobCancellReason){
    this.jobCancellReason = jobCancellReason;
}

public Object getJobCancellReason(){
    return jobCancellReason;
}

@Override
public String toString(){
    return 
        "DataItem{" + 
        "destinationLat = '" + destinationLat + '\'' + 
        ",isRouteSelected = '" + isRouteSelected + '\'' + 
        ",destinationLng = '" + destinationLng + '\'' + 
        ",startTime = '" + startTime + '\'' + 
        ",estimatedCost = '" + estimatedCost + '\'' + 
        ",vehicleId = '" + vehicleId + '\'' + 
        ",sourceName = '" + sourceName + '\'' + 
        ",seatPlanJson = '" + seatPlanJson + '\'' + 
        ",isJobCancelled = '" + isJobCancelled + '\'' + 
        ",isJobStarted = '" + isJobStarted + '\'' + 
        ",driverId = '" + driverId + '\'' + 
        ",sourceLat = '" + sourceLat + '\'' + 
        ",eta = '" + eta + '\'' + 
        ",isJobCompleted = '" + isJobCompleted + '\'' + 
        ",totalSeatBookingRequest = '" + totalSeatBookingRequest + '\'' + 
        ",destinationName = '" + destinationName + '\'' + 
        ",selectedRoute = '" + selectedRoute + '\'' + 
        ",id = '" + id + '\'' + 
        ",sourceLng = '" + sourceLng + '\'' + 
        ",estimatedFuelConsumption = '" + estimatedFuelConsumption + '\'' + 
        ",jobCancellReason = '" + jobCancellReason + '\'' + 
        "}";
    }
}

1 个答案:

答案 0 :(得分:3)

使用String代替Object。编写以下代码

@SerializedName("SelectedRoute")
private String selectedRoute 

代替

  @SerializedName("SelectedRoute")
  private Object selectedRoute;