我是android中的新程序员我得到了Gson错误

时间:2017-06-22 09:52:19

标签: android json

public class OrderBook implements Serializable{

    private String name;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    @SerializedName("AppOrdID")
    @Expose
    private String appOrdID;
    @SerializedName("ClientID")
    @Expose
    private String clientID;
    @SerializedName("ExchangeSegment")
    @Expose
    private Integer exchangeSegment;
    @SerializedName("InstrumentID")
    @Expose
    private String instrumentID;
    @SerializedName("TradeSymbol")
    @Expose
    private String tradeSymbol;
    @SerializedName("OrderStatus")
    @Expose
    private Integer orderStatus;
    @SerializedName("OrderSide")
    @Expose
    private Integer orderSide;
    @SerializedName("OrderQuantity")
    @Expose
    private Integer orderQuantity;
    @SerializedName("OrderPrice")
    @Expose
    private Double orderPrice;
    @SerializedName("ProductType")
    @Expose
    private Integer productType;
    @SerializedName("TradedQuantity")
    @Expose
    private Integer tradedQuantity;
    @SerializedName("RemainingQuantity")
    @Expose
    private Integer remainingQuantity;
    @SerializedName("OrderType")
    @Expose
    private Integer orderType;
    @SerializedName("TimeInForce")
    @Expose
    private Integer timeInForce;
    @SerializedName("TriggerPrice")
    @Expose
    private Integer triggerPrice;
    @SerializedName("DisclosedQuantity")
    @Expose
    private Integer disclosedQuantity;
    @SerializedName("AveragePrice")
    @Expose
    private Integer averagePrice;
    @SerializedName("ExpiryDate")
    @Expose
    private String expiryDate;
    @SerializedName("OrderTime")
    @Expose
    private String orderTime;
    @SerializedName("TradeTime")
    @Expose
    private String tradeTime;
    @SerializedName("UpdateTime")
    @Expose
    private String updateTime;
    @SerializedName("ExchangeOrderID")
    @Expose
    private String exchangeOrderID;
    @SerializedName("ExchangeOrderUpdateTime")
    @Expose
    private String exchangeOrderUpdateTime;
    @SerializedName("UserID")
    @Expose
    private String userID;
    @SerializedName("RejectReason")
    @Expose
    private String rejectReason;
    @SerializedName("RequestID")
    @Expose
    private String requestID;

    // new  add
    @SerializedName("ScripName")
    @Expose
    private String scripName;
    @SerializedName("OrderValidityDate")
    @Expose
    private String orderValidityDate;
    @SerializedName("MarketProtection")
    @Expose
    private String marketProtection;
    @SerializedName("CancelledQuantity")
    @Expose
    private String cancelledQuantity;
    @SerializedName("TickSize")
    @Expose
    private String tickSize;
    @SerializedName("DecimalPrecision")
    @Expose
    private String decimalPrecision;
    @SerializedName("Multiplier")
    @Expose
    private String multiplier;
    @SerializedName("NoMarketProtection")
    @Expose
    private String noMarketProtection;
    @SerializedName("DefaultMarketProtection")
    @Expose
    private String defaultMarketProtection;
    @SerializedName("ReferenceOrdID")
    @Expose
    private String referenceOrdID;
    @SerializedName("COPercentage")
    @Expose
    private String coPercentage;
    @SerializedName("InstrumentName")
    @Expose
    private String instrumentName;
    @SerializedName("ExpSsbDate")
    @Expose
    private String expSsbDate;
    @SerializedName("discQtyPerc")
    @Expose
    private String discQtyPerc;
    @SerializedName("Minqty")
    @Expose
    private String minqty;
    @SerializedName("BrokerClient")
    @Expose
    private String brokerClient;
    @SerializedName("PriceNum")
    @Expose
    private String priceNum;
    @SerializedName("GenNum")
    @Expose
    private String genNum;
    @SerializedName("PriceDenum")
    @Expose
    private String priceDenum;
    @SerializedName("GenDenum")
    @Expose
    private String genDenum;
    @SerializedName("Series")
    @Expose
    private String series;
    @SerializedName("OrderGenerationType")
    @Expose
    private String orderGenerationType;
    @SerializedName("SIPIndicator")
    @Expose
    private String sipIndicator;
    @SerializedName("OrderSource")
    @Expose
    private String orderSource;
    @SerializedName("Remarks")
    @Expose
    private String remarks;
    @SerializedName("MarketProPercentage")
    @Expose
    private String marketProPercentage;
    @SerializedName("ReportType")
    @Expose
    private String reportType;
    @SerializedName("RefLmtPrice")
    @Expose
    private String refLmtPrice;



    public String getAppOrdID() {
        return appOrdID;
    }

    public void setAppOrdID(String appOrdID) {
        this.appOrdID = appOrdID;
    }

    public String getClientID() {
        return clientID;
    }

    public void setClientID(String clientID) {
        this.clientID = clientID;
    }

    public Integer getExchangeSegment() {
        return exchangeSegment;
    }

    public void setExchangeSegment(Integer exchangeSegment) {
        this.exchangeSegment = exchangeSegment;
    }

    public String getInstrumentID() {
        return instrumentID;
    }

    public void setInstrumentID(String instrumentID) {
        this.instrumentID = instrumentID;
    }

    public String getTradeSymbol() {
        return tradeSymbol;
    }

    public void setTradeSymbol(String tradeSymbol) {
        this.tradeSymbol = tradeSymbol;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Integer getOrderSide() {
        return orderSide;
    }

    public void setOrderSide(Integer orderSide) {
        this.orderSide = orderSide;
    }

    public Integer getOrderQuantity() {
        return orderQuantity;
    }

    public void setOrderQuantity(Integer orderQuantity) {
        this.orderQuantity = orderQuantity;
    }

    public Double getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(Double orderPrice) {
        this.orderPrice = orderPrice;
    }

    public Integer getProductType() {
        return productType;
    }

    public void setProductType(Integer productType) {
        this.productType = productType;
    }

    public Integer getTradedQuantity() {
        return tradedQuantity;
    }

    public void setTradedQuantity(Integer tradedQuantity) {
        this.tradedQuantity = tradedQuantity;
    }

    public Integer getRemainingQuantity() {
        return remainingQuantity;
    }

    public void setRemainingQuantity(Integer remainingQuantity) {
        this.remainingQuantity = remainingQuantity;
    }

    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    public Integer getTimeInForce() {
        return timeInForce;
    }

    public void setTimeInForce(Integer timeInForce) {
        this.timeInForce = timeInForce;
    }

    public Integer getTriggerPrice() {
        return triggerPrice;
    }

    public void setTriggerPrice(Integer triggerPrice) {
        this.triggerPrice = triggerPrice;
    }

    public Integer getDisclosedQuantity() {
        return disclosedQuantity;
    }

    public void setDisclosedQuantity(Integer disclosedQuantity) {
        this.disclosedQuantity = disclosedQuantity;
    }

    public Integer getAveragePrice() {
        return averagePrice;
    }

    public void setAveragePrice(Integer averagePrice) {
        this.averagePrice = averagePrice;
    }

    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public String getTradeTime() {
        return tradeTime;
    }

    public void setTradeTime(String tradeTime) {
        this.tradeTime = tradeTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getExchangeOrderID() {
        return exchangeOrderID;
    }

    public void setExchangeOrderID(String exchangeOrderID) {
        this.exchangeOrderID = exchangeOrderID;
    }

    public String getExchangeOrderUpdateTime() {
        return exchangeOrderUpdateTime;
    }

    public void setExchangeOrderUpdateTime(String exchangeOrderUpdateTime) {
        this.exchangeOrderUpdateTime = exchangeOrderUpdateTime;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getRejectReason() {
        return rejectReason;
    }

    public void setRejectReason(String rejectReason) {
        this.rejectReason = rejectReason;
    }

    public String getRequestID() {
        return requestID;
    }

    public void setRequestID(String requestID) {
        this.requestID = requestID;
    }

    public String getScripName() {
        return scripName;
    }

    public void setScripName(String scripName) {
        this.scripName = scripName;
    }

    public String getOrderValidityDate() {
        return orderValidityDate;
    }

    public void setOrderValidityDate(String orderValidityDate) {
        this.orderValidityDate = orderValidityDate;
    }

    public String getMarketProtection() {
        return marketProtection;
    }

    public void setMarketProtection(String marketProtection) {
        this.marketProtection = marketProtection;
    }

    public String getCancelledQuantity() {
        return cancelledQuantity;
    }

    public void setCancelledQuantity(String cancelledQuantity) {
        this.cancelledQuantity = cancelledQuantity;
    }

    public String getTickSize() {
        return tickSize;
    }

    public void setTickSize(String tickSize) {
        this.tickSize = tickSize;
    }

    public String getDecimalPrecision() {
        return decimalPrecision;
    }

    public void setDecimalPrecision(String decimalPrecision) {
        this.decimalPrecision = decimalPrecision;
    }

    public String getMultiplier() {
        return multiplier;
    }

    public void setMultiplier(String multiplier) {
        this.multiplier = multiplier;
    }

    public String getNoMarketProtection() {
        return noMarketProtection;
    }

    public void setNoMarketProtection(String noMarketProtection) {
        this.noMarketProtection = noMarketProtection;
    }

    public String getDefaultMarketProtection() {
        return defaultMarketProtection;
    }

    public void setDefaultMarketProtection(String defaultMarketProtection) {
        this.defaultMarketProtection = defaultMarketProtection;
    }

    /*public String getSyomOrderID() {
        return syomOrderID;
    }

    public void setSyomOrderID(String syomOrderID) {
        this.syomOrderID = syomOrderID;
    }*/

    public String getReferenceOrdID() {
        return referenceOrdID;
    }

    public void setReferenceOrdID(String referenceOrdID) {
        this.referenceOrdID = referenceOrdID;
    }

    public String getCoPercentage() {
        return coPercentage;
    }

    public void setCoPercentage(String coPercentage) {
        this.coPercentage = coPercentage;
    }

    public String getInstrumentName() {
        return instrumentName;
    }

    public void setInstrumentName(String instrumentName) {
        this.instrumentName = instrumentName;
    }

    public String getExpSsbDate() {
        return expSsbDate;
    }

    public void setExpSsbDate(String expSsbDate) {
        this.expSsbDate = expSsbDate;
    }

    public String getDiscQtyPerc() {
        return discQtyPerc;
    }

    public void setDiscQtyPerc(String discQtyPerc) {
        this.discQtyPerc = discQtyPerc;
    }

    public String getMinqty() {
        return minqty;
    }

    public void setMinqty(String minqty) {
        this.minqty = minqty;
    }

    public String getBrokerClient() {
        return brokerClient;
    }

    public void setBrokerClient(String brokerClient) {
        this.brokerClient = brokerClient;
    }

    public String getPriceNum() {
        return priceNum;
    }

    public void setPriceNum(String priceNum) {
        this.priceNum = priceNum;
    }

    public String getGenNum() {
        return genNum;
    }

    public void setGenNum(String genNum) {
        this.genNum = genNum;
    }

    public String getPriceDenum() {
        return priceDenum;
    }

    public void setPriceDenum(String priceDenum) {
        this.priceDenum = priceDenum;
    }

    public String getGenDenum() {
        return genDenum;
    }

    public void setGenDenum(String genDenum) {
        this.genDenum = genDenum;
    }

    public String getSeries() {
        return series;
    }

    public void setSeries(String series) {
        this.series = series;
    }

    public String getOrderGenerationType() {
        return orderGenerationType;
    }

    public void setOrderGenerationType(String orderGenerationType) {
        this.orderGenerationType = orderGenerationType;
    }

    public String getSipIndicator() {
        return sipIndicator;
    }

    public void setSipIndicator(String sipIndicator) {
        this.sipIndicator = sipIndicator;
    }

    public String getOrderSource() {
        return orderSource;
    }

    public void setOrderSource(String orderSource) {
        this.orderSource = orderSource;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getMarketProPercentage() {
        return marketProPercentage;
    }

    public void setMarketProPercentage(String marketProPercentage) {
        this.marketProPercentage = marketProPercentage;
    }

    public String getReportType() {
        return reportType;
    }

    public void setReportType(String reportType) {
        this.reportType = reportType;
    }

    public String getRefLmtPrice() {
        return refLmtPrice;
    }

    public void setRefLmtPrice(String refLmtPrice) {
        this.refLmtPrice = refLmtPrice;
    }
}

我得到并且错误请帮助我

  
    

{serializeNulls:falsefactories:[Factory [typeHierarchy = com.google.gson.JsonElement,adapter = com.google.gson.internal.bind.TypeAdapters $ 25 @ 250463],com.google.gson.internal.bind.ObjectTypeAdapter $ 1 @ eab3860,com.google.gson.internal.Excluder @ 4547119,Factory [type = java.lang.String,adapter = com.google.gson.internal.bind.TypeAdapters $ 13 @ 4bff5de],Factory [type = java。 lang.Integer + int,adapter = com.google.gson.internal.bind.TypeAdapters $ 7 @ a5983bf],Factory [type = java.lang.Boolean + boolean,adapter = com.google.gson.internal.bind.TypeAdapters $ 3 @ 2fb7a8c],Factory [type = java.lang.Byte + byte,adapter = com.google.gson.internal.bind.TypeAdapters $ 5 @ 8b205d5],Factory [type = java.lang.Short + short,adapter = com。 google.gson.internal.bind.TypeAdapters$6@95191ea],工厂[type = java.lang.Long + long,adapter = com.google.gson.internal.bind.TypeAdapters $ 8 @ 72c9cdb],Factory [type = java。 lang.Double + double,adapter = com.google.gson.Gson $ 3 @ 22bb378],Factory [type = java.lang.Float + float,adapter = com.google.gson.Gson $ 4 @ 41a2a51],Factory [type = java.lang.Number,adapter = com.google.gson.internal.bind.TypeAdapters $ 11 @ 3aee2b6],Factory [type = java.lang.Character + char,adapter = com.google.gson.internal.bind.TypeAdapters $ 12 @ 94e2bb7],Factory [type = java.lang.StringBuilder,adapter = com.google.gson.internal.bind.TypeAdapters $ 16 @ e248f24],Factory [type = java.lang.StringBuffer,adapter = com.google.gson .internal.bind.TypeAdapters $ 17 @ 3061a8d],Factory [type = java.math.BigDecimal,adapter = com.google.gson.internal.bind.TypeAdapters $ 14 @ bbe7442],Factory [type = java.math.BigInteger,adapter =com.google.gson.internal.bind.TypeAdapters$15@48fcc53],工厂[type = java.net.URL,adapter = com.google.gson.internal.bind.TypeAdapters $ 18 @ cad7990],工厂[type = java .net.URI,adapter = com.google.gson.internal.bind.TypeAdapters $ 19 @ 646d289],Factory [type = java.util.UUID,adapter = com.google.gson.internal.bind.TypeAdapters $ 21 @ f43928e] ,Factory [type = java.util.Locale,adapter = com.google.gson.internal.bind.TypeAdapters $ 24 @ e40daaf],Factory [typeHierarchy = java.net.InetAddress,adapter = co m.google.gson.internal.bind.TypeAdapters$20@6989ebc],Factory [type = java.util.BitSet,adapter = com.google.gson.internal.bind.TypeAdapters $ 2 @ c10e45],com.google.gson。 internal.bind.DateTypeAdapter$1@2ea499a,Factory [type = java.util.Calendar + java.util.GregorianCalendar,adapter = com.google.gson.internal.bind.TypeAdapters $ 23 @ 74a72cb],com.google.gson.internal .bind.TimeTypeAdapter $ 1 @ daeeaa8,com.google.gson.internal.bind.SqlDateTypeAdapter $ 1 @ 4e949c1,com.google.gson.internal.bind.TypeAdapters$22 @ 8136566,com.google.gson.internal.bind.ArrayTypeAdapter $ 1 @ c0b70a7,Factory [type = java.lang.Class,adapter = com.google.gson.internal.bind.TypeAdapters $ 1 @ 55c0954],com.google.gson.internal.bind.CollectionTypeAdapterFactory@dffc0fd,com.google.gson .internal.bind.MapTypeAdapterFactory @ 36071f2,com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory @ 5f47043,com.google.gson.internal.bind.TypeAdapters$26 @ aaa66c0,com.google.gson.internal.bind.ReflectiveTypeAdapterFactory @ 10c6ff9],instanceCreators:{}}

  

2 个答案:

答案 0 :(得分:0)

您可以安装一个插件,轻松为您的json响应创建POJO类。按照以下步骤操作,希望这可以帮到您

  1. 安装GsonFormat插件

  2. 生成新课程。

  3. 在这个新课程中,在课堂正文中,右键单击。

  4. 打开的菜单中的
  5. 选择Generate。

  6. 在打开的新菜单中选择GsonFormat。

答案 1 :(得分:0)

public class Codes{
    public String code;
    public String price;
}

class Result
{
ArrayList<Codes> codes = new ArrayList();

// create getter setter of 'codes' variable.

}