title: How to create pojo class of Object of ArrayList from REST API response?
body: <p>I'm working on project in which I have to implement on API. This API repsonse is objects of ArrayList. Can you please help me with creating its POJO class and if possible its implementation. I'm using retrofit2 &amp; GSON.</p>
  <p>As shown in following JSON schema, brand names will be added in <code>brandsonly</code> by admin, and it will be added in <code>allorders</code> as a arraylist which have multiple sub-objects.</p>
  <p>Like, if admin add <code>Redmi</code> in the <code>brandsonly</code> then it will create <code>Redmi[]</code> in the <code>allorders</code></p>
  <pre><code>{
      &quot;status&quot;: &quot;success&quot;,
      &quot;brandsonly&quot;: [
          {
              &quot;_id&quot;: &quot;&quot;,
              &quot;brandname&quot;: &quot;SAMSUNG&quot;,
          },
          {
              &quot;_id&quot;: &quot;&quot;,
              &quot;brandname&quot;: &quot;VIVO&quot;,
          },
          {
              &quot;_id&quot;: &quot;&quot;,
              &quot;brandname&quot;: &quot;NOKIA&quot;
          },
          {
              &quot;_id&quot;: &quot;&quot;,
              &quot;brandname&quot;: &quot;IPHONE&quot;,
          }
      ],
      &quot;allorders&quot;: {
          &quot;SAMSUNG&quot;: [],
          &quot;VIVO&quot;: [],
          &quot;NOKIA&quot;: [],
          &quot;IPHONE&quot;: [
              {
                  &quot;_id&quot;: &quot;&quot;,
                  &quot;order_id&quot;: &quot;&quot;,
                  &quot;__v&quot;: 0,
                  &quot;adminconfirmation&quot;: 1,
                  &quot;finalpricetodeduct&quot;: 30950
              },
              {
                  &quot;_id&quot;: &quot;&quot;,
                  &quot;order_id&quot;: &quot;&quot;,
                  &quot;__v&quot;: 0,
                  &quot;adminconfirmation&quot;: 1,
                  &quot;finalpricetodeduct&quot;: 
              }
          ]
      },
  }
  </code></pre>
  <p>My Retrofit call from activity:</p>
  <pre><code>        final AllOrdersResponse allOrdersResponse = new AllOrdersResponse(userID);
          Call&lt;AllOrdersResponse&gt; responseCall = retrofit_interface.allOrderResponse(allOrdersResponse, &quot;Bearer &quot; + AuthToken);
  
          responseCall.enqueue(new Callback&lt;AllOrdersResponse&gt;() {
              @Override
              public void onResponse(@NotNull Call&lt;AllOrdersResponse&gt; call, @NotNull Response&lt;AllOrdersResponse&gt; response) {
                  AllOrdersResponse response1 = response.body();
              
              }
  
              @Override
              public void onFailure(@NotNull Call&lt;AllOrdersResponse&gt; call, @NotNull Throwable t) {
                  if (t instanceof SocketTimeoutException)
                      Toast.makeText(context, &quot;Socket Time out. Please try again.&quot;, Toast.LENGTH_LONG).show();
                  else
                      Toast.makeText(context, t.toString(), Toast.LENGTH_LONG).show();
              }
          });
  
  </code></pre>