title: Get JSONArray from JSONObject with retrofit
body: <p>I'm working with Wordpress and i want to get custom fields but i can't find anything how can i get them or if i can, The closest answer that i can find is this <a href="https://stackoverflow.com/questions/41017014/how-to-get-json-array-and-json-object-response-from-retrofit-response">How to get JSON ARRAY and JSON object response from retrofit response?</a> but i can't understand how i can work in my favor, i'm new at working with retrofit2. Can you tell me if it's possible to do that and if so how?
  Here is the JSON respond i'm trying to work with</p>
  
  <pre><code>    {
    "status": "ok",
    "post": {
      "id": 748,
      "type": "post",
      "slug": "string",
      "url": string",
      "status": "publish",
      "title": "s",
      "title_plain": "",
      "content": "",
      "excerpt": "&lt;p&gt;&lt;\/p&gt;\n",
      "date": "2017-11-03 12:43:53",
      "modified": "2018-02-27 20:15:43",
      "categories": [
        {
          "id": 3,
          "slug": "music",
          "title": "Music",
          "description": "",
          "parent": 0,
          "post_count": 134
        }
      ],
      "tags": [
        {
          "id": 9,
          "slug": "altezzaiscute24",
          "title": "AltezzaIscute24",
          "description": "",
          "post_count": 1
        },
        {
          "id": 7,
          "slug": "amv",
          "title": "AMV",
          "description": "",
          "post_count": 6
        },
        {
          "id": 4,
          "slug": "atlantic-records",
          "title": "Atlantic Records",
          "description": "",
          "post_count": 1
        },
        {
          "id": 8,
          "slug": "discord",
          "title": "Discord",
          "description": "",
          "post_count": 1
        },
        {
          "id": 5,
          "slug": "hero",
          "title": "Hero",
          "description": "",
          "post_count": 1
        },
        {
          "id": 10,
          "slug": "skillet",
          "title": "Skillet",
          "description": "",
          "post_count": 1
        },
        {
          "id": 6,
          "slug": "",
          "title": "",
          "description": "",
          "post_count": 1
        }
      ],
      "author": {
        "id": 1,
        "slug": "admin",
        "name": "admin",
        "first_name": "",
        "last_name": "",
        "nickname": "admin",
        "url": "",
        "description": ""
      },
      "comments": [
        {
          "id": 335,
          "name": "\u7231Neko",
          "url": "",
          "date": "2017-11-03 12:44:51",
          "content": "&lt;p&gt;Amazing..!! \ud83d\ude00&lt;\/p&gt;\n",
          "parent": 0
        },
        {
          "id": 334,
          "name": "AltezzaIscute24(Ex. importednascar)",
          "url": "",
          "date": "2017-11-03 12:45:35",
          "content": "&lt;p&gt;Nice one!&lt;\/p&gt;\n",
          "parent": 0
        },
        {
          "id": 333,
          "name": "NjustN",
          "url": "",
          "date": "2017-11-03 12:51:27",
          "content": "&lt;p&gt;&lt;\/p&gt;\n",
          "parent": 
        }
      ],
      "attachments": [
        {
          "id": 1447,
          "url": "/",
          "slug": "",
          "title": "",
          "description": "",
          "caption": "",
          "parent": 748,
          "mime_type": "image\/jpeg",
          "images": {
            "full": {
              "url": "",
              "width": 1280,
              "height": 720
            },
            "thumbnail": {
              "url": ",
              "width": 150,
              "height": 150
            },
            "medium": {
              "url": "",
              "width": 300,
              "height": 169
            },
  
          }
        }
      ],
      "comment_count": 3,
      "comment_status": "open",
      "thumbnail": "",
      "custom_fields": {
        "yvtwp_video_datas": [
          "}"
        ],
        "yvtwp_video_key": [
          "h"
        ],
        "yvtwp_feed_key": [
          "j"
        ],
        "yvtwp_import_id": [
          "1"
        ],
        "tie_video_url": [
          "https:\/\/www.youtube.com\/watch?v="
        ],
        "tie_embed_code": [
          "&lt;iframe width=\"100%\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/\" frameborder=\"0\" allowfullscreen&gt;&lt;\/iframe&gt;"
        ],
        "tie_post_head": [
          "video"
        ],
        "tie_views": [
          "2160"
        ],
        "tie_post_head_cover": [
          "true"
        ],
        "post_background_full": [
          "true"
        ],
        "video_time": [
          "2:38"
        ],
        "video_likes": [
          "27"
        ],
        "yvtwp_count_synchronize_video_per_day": [
          "1"
        ],
        "yvtwp_synchronize_video_last_date": [
          "2018-02-27 20:15:44"
        ],
        "yvtwp_count_check_comments_per_day": [
          "1"
        ],
        "yvtwp_check_comments_last_date": [
          "2018-02-27 20:15:44"
        ],
        "yvtwp_views_count": [
          "18"
        ]
      },
  
    "previous_url": "/"
  }
  </code></pre>
  
  <p><strong>Edit 1</strong>
  Answer that <strong>Fazal Hussain</strong> gave i tried and i'm getting this error:</p>
  
  <pre><code>03-06 21:31:30.750 1455-1455/xyz.wizardsong102 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: xyz.wizardsong102, PID: 1455
                                                                   java.lang.NullPointerException: Attempt to read from field 'java.util.List com.xyz.wizardsong102.model.CustomFields.tieVideoUrl' on a null object reference
                                                                       at com.xyz.wizardsong102.ActivityPostDetails$2.onResponse(ActivityPostDetails.java:180)
                                                                       at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
                                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                       at android.os.Looper.loop(Looper.java:148)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5422)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>and this my activity:</p>
  
  <pre><code>callbackCall.enqueue(new Callback&lt;CallbackDetailsPost&gt;() {
              @Override
              public void onResponse(Call&lt;CallbackDetailsPost&gt; call, Response&lt;CallbackDetailsPost&gt; response) {
                  CallbackDetailsPost resp = response.body();
                 // Log.i(TAG, "response:w "+ post.customFields.tieVideoUrl);
                  if (resp != null &amp;&amp; resp.status.equals("ok")) {
  
                      //Log.d("json api res: ", "resposd: "+ resp);
                      post = resp.post;
                      displayPostData(false);
  
                      Log.i(TAG, "response:w "+ post.customFields.tieVideoUrl);
                      swipeProgress(false);
                  } else {
                      String error = resp.status;
                      onFailRequest(error);
                  }
              }
  
              @Override
              public void onFailure(Call&lt;CallbackDetailsPost&gt; call, Throwable t) {
                  Log.d(TAG, "Faild: ", t);
                  String error = t.toString();
                  if (!call.isCanceled()) onFailRequest(error);
              }
  
          });
      }
  </code></pre>
  
  <p>Edit 2:</p>
  
  <p>Post.java</p>
  
  <pre><code>import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.List;
  
  import io.realm.RealmList;
  
  
  public class Post implements Serializable {
  
      public int id = -1;
      public String type = "";
      public String slug = "";
      public String url = "";
      public String status = "";
      public String title = "";
      public String title_plain = "";
      public String content = "";
      public String excerpt = "";
      public String date = "";
      public String modified = "";
      public String thumbnail = "";
      public int comment_count = -1;
      public CustomFields customFields;
  
      public List&lt;Category&gt; categories = new ArrayList&lt;&gt;();
      public Author author = null;
      public List&lt;Comment&gt; comments = new ArrayList&lt;&gt;();
      public List&lt;Attachment&gt; attachments = new ArrayList&lt;&gt;();
  
      public PostRealm getObjectRealm() {
          PostRealm p = new PostRealm();
          p.id = id;
          p.type = type;
          p.slug = slug;
          p.url = url;
          p.status = status;
          p.title = title;
          p.title_plain = title_plain;
          p.content = content;
          p.excerpt = excerpt;
          p.date = date;
          p.modified = modified;
          p.thumbnail = thumbnail;
          p.comment_count = comment_count;
  
  
          p.categories = new RealmList&lt;&gt;();
          for (Category c : categories) { p.categories.add(c.getObjectRealm()); }
  
  
  
          p.comments = new RealmList&lt;&gt;();
          for (Comment c : comments) { p.comments.add(c.getObjectRealm()); }
  
          p.author = ( author != null ? author.getObjectRealm() : null );
  
          p.attachments = new RealmList&lt;&gt;();
          for (Attachment a : attachments) { p.attachments.add(a.getObjectRealm()); }
  
  
          return p;
      }
  
      public boolean isDraft(){
          return !(content != null &amp;&amp; !content.trim().equals(""));
      }
  
  }
  </code></pre>
  
  <p>CustomFields.java</p>
  
  <pre><code>import java.io.Serializable;
  import java.util.List;
  
  public class CustomFields implements Serializable
  {
  
      public List&lt;String&gt; yvtwpVideoKey = null;
      public List&lt;String&gt; yvtwpFeedKey = null;
      public List&lt;String&gt; yvtwpImportId = null;
      public List&lt;String&gt; tieVideoUrl = null;
      public List&lt;String&gt; tieViews = null;
      public List&lt;String&gt; videoTime = null;
      public List&lt;String&gt; videoLikes = null;
  }
  </code></pre>
  
  <p>Edit 3 
  <a href="https://i.stack.imgur.com/Br5df.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Br5df.png" alt="Error"></a></p>