com.fasterxml.jackson.databind.exc.MismatchedInputException:意外的令牌(START_OBJECT),预计START_ARRAY:

时间:2018-04-13 17:20:54

标签: android json jackson ioexception

我正在尝试将create index nci on dbo.history_integer(value,datetime) include (rest of columns in select ) 保存到android SearchAvailableRidesRequestOffline。我需要Shared Preferences对象以后再使用它。当我尝试从deserialise deserialise时,我得到了这个例外。

IOException的

json

JSON

com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected token (START_OBJECT), expected START_ARRAY: need JSON Array to contain As.WRAPPER_ARRAY type information for class com.mnox.webservices.core.ARequest
 at [Source: (String)"{
  "request" : {
     .....
        "filterType"[truncated 882 chars]; line: 2, column: 15] (through reference chain: com.mnox.paymentgateway.commons.support.offline.SearchAvailableRidesRequestOffline["request"])

爪哇

{
  "request" : {
    //
    // SearchAvailableRidesRequest
    // Parameters
  },
  "concreateRequestClass" : "com.mnox.webservices.requests.v2.SearchAvailableRidesRequest",
  "currentActivity" : null,
  "maxLimitAllowed" : 1000,
  "priority" : 0,
  "requestType" : "mNoxSearch"
}

1 个答案:

答案 0 :(得分:2)

记住:

  
      
  • 如果.json内容以 {开头,则被视为 Json对象

  •   
  • 如果.json内容以 [开头,则被视为 Json数组

  •   

您有此错误

  

com.fasterxml.jackson.databind.exc.MismatchedInputException:   意外的令牌(START_OBJECT),预计START_ARRAY:

因为你期待一个Json数组,但你的响应是一个Json对象:

"{
  "request" : {
   ...
   ...

检查您的回复。