title: [Retrofit]: Expected BEGIN_OBJECT but was BEGIN_ARRAY
body: <p>This error is back !</p>
  
  <p>I'm a beginner with Retrofit, I've saw this post: <a href="https://stackoverflow.com/questions/30210000/retrofit-expected-begin-object-but-was-begin-array">Retrofit: Expected BEGIN_OBJECT but was BEGIN_ARRAY</a></p>
  
  <p>But I still can't make it work even if I try to adapt it to my model. So my error is:</p>
  
  <pre><code>Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 55 path $[0].genericDevice
  </code></pre>
  
  <p>What I get:</p>
  
  <pre><code>[
    {
      "deviceUuid": "btB4:99:4C:59:F8:1F",
      "genericDevice": {
        "manufacturerName": "BeeWi",
        "productName": "BeeWi BBL207",
        "smartFunctions": [
          "switch",
          "rgbled",
          "whiteled"
        ]
      }
    },
    {
      "deviceUuid": "btD0:39:72:B8:93:F2",
      "genericDevice": {
        "manufacturerName": "AwoX",
        "productName": "SML-c9",
        "smartFunctions": [
          "switch",
          "whiteled",
          "rgbled"
        ]
      }
    },
    {
      "deviceUuid": "bt20:C3:8F:E4:B2:2A",
      "genericDevice": {
        "manufacturerName": "Iwedia",
        "productName": "RTRKSP",
        "smartFunctions": [
          "switch",
          "smartmeter"
        ]
      }
    },
    {
      "deviceUuid": "btA0:14:3D:0C:D3:74",
      "genericDevice": {
        "manufacturerName": "Parrot",
        "productName": "Flower power",
        "smartFunctions": [
          "switch",
          "battery",
          "plantmanager"
        ]
      }
    },
    {
      "deviceUuid": "bt78:A5:04:5A:0B:36",
      "genericDevice": {
        "manufacturerName": "BeeWi",
        "productName": "BeeWi SmartClim",
        "smartFunctions": [
          "temperaturehumidity"
        ]
      }
    },
    {
      "deviceUuid": "bt54:4A:16:59:E4:86",
      "genericDevice": {
        "manufacturerName": "AwoX",
        "productName": "AL-Bc7",
        "smartFunctions": [
          "switch",
          "rgbled",
          "whiteled",
          "oildiffuser"
        ]
      }
    }
  ]
  </code></pre>
  
  <p>The parsing class' attributes:</p>
  
  <pre><code>private String             deviceUuid;
  private IoTGenericDevice   ioTGncDvc;
  </code></pre>
  
  <p>The IoTGenericDevice subclass' attributes:</p>
  
  <pre><code>public String                   manufacturerName;
  public String                   productName;
  public ArrayList&lt;String&gt;        smartFunctions = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>The Retrofit call:</p>
  
  <pre><code>@GET("/iot/scanning")
  public void             getIoTs(@Header(Auth.ID_SESSION_HEADER) String idSession, Callback&lt;IoT[]&gt; cbk);
  </code></pre>
  
  <p>The Manager:</p>
  
  <pre><code>public void             getIoTs(final CallbackIoTs cbkIoTs)
      {
          AdapterUtils.createBboxService(bbox, IBboxIoTService.class).getIoTs
                  (bbox.getSessionId(), new Callback&lt;List&lt;IoT&gt;&gt;()                                       //REST call
                  {
                      @Override
                      public void success(List&lt;IoT&gt; iots, Response rsp)
                      {
                          int statCode = rsp.getStatus();
  
                          if (statCode == 200) {
                              List&lt;IoT&gt; iotLst = Arrays.asList(iots);
                              Log.e(LOG_TAG, iotLst.get(0).getIoTGncDvc().getMnf());
                              cbkIoTs.onResult(statCode, iotLst);
                          } else {
                              Log.e(LOG_TAG, "Unexpected response while getting IoTs. HTTP code: "
                                      + String.valueOf(statCode)
                                      + " - 200 expected");
                              cbkIoTs.onResult(statCode, null);
                          }
                      }
  
                      @Override
                      public void failure(RetrofitError rtfErr)
                      {
                          int statCode = 500;
  
                          if (rtfErr.getResponse() != null)
                              statCode = rtfErr.getResponse().getStatus();
                          Log.e(LOG_TAG, "Error while getting IoTs. HTTP code: "
                                  + String.valueOf(statCode)
                                  + " - Server response: "
                                  + rtfErr.getMessage());
                          cbkIoTs.onResult(statCode, null);
                      }
                  });
      }
  </code></pre>