从Json(序列化表格)中为Android(JAVA)检索数据

时间:2018-10-19 11:24:16

标签: java android arrays json

这是我想从中检索数据的json数组。我正在制作一个实时比分upadtes应用程序,因此将使用api获取实时比分并将其显示在应用程序上。这是整个api。

{
   "status":"ok",
   "post":{
      "id":1168,
      "type":"sp_event",
      "slug":"match-20-haryana-steelers-vs-u-mumba",
      "url":"http:\/\/fantasy-arena.com\/event\/match-20-haryana-steelers-vs-u-mumba\/",
      "status":"publish",
      "title":"Match 20, Haryana Steelers vs U Mumba",
      "title_plain":"Match 20, Haryana Steelers vs U Mumba",
      "content":"",
      "excerpt":"<p>Match 20, Haryana Steelers vs U Mumba<\/p>\n",
      "date":"2018-10-17 21:00:03",
      "modified":"2018-10-19 16:47:50",
      "categories":[

      ],
      "tags":[

      ],
      "author":{
         "id":1,
         "slug":"admin",
         "name":"Sports Master",
         "first_name":"",
         "last_name":"",
         "nickname":"Sports Master",
         "url":"",
         "description":""
      },
      "comments":[

      ],
      "attachments":[

      ],
      "comment_count":0,
      "comment_status":"closed",
      "custom_fields":{
         "sp_status":[
            "ok"
         ],
         "sp_format":[
            "league"
         ],
         "sp_mode":[
            "team"
         ],
         "sp_day":[
            ""
         ],
         "sp_minutes":[
            ""
         ],
         "sp_results":[
            "a:2:{i:688;a:4:{s:9:\"firsthalf\";s:2:\"13\";s:10:\"secondhalf\";s:2:\"19\";s:6:\"points\";s:2:\"32\";s:7:\"outcome\";a:1:{i:0;s:4:\"loss\";}}i:691;a:4:{s:9:\"firsthalf\";s:2:\"24\";s:10:\"secondhalf\";s:2:\"18\";s:6:\"points\";s:2:\"42\";s:7:\"outcome\";a:1:{i:0;s:3:\"win\";}}}"
         ],
         "sp_result_columns":[
            "a:2:{i:0;s:9:\"firsthalf\";i:1;s:6:\"points\";}"
         ],
         "sp_players":[
            "a:2:{i:688;a:11:{i:0;a:6:{s:3:\"pts\";s:0:\"\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:0:\"\";}i:764;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:2:\"15\";s:10:\"totalraids\";s:2:\"21\";s:8:\"touchpts\";s:2:\"11\";s:8:\"bonuspts\";s:1:\"4\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:1:\"1\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:765;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:1:\"4\";s:10:\"totalraids\";s:2:\"12\";s:8:\"touchpts\";s:1:\"2\";s:8:\"bonuspts\";s:1:\"2\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:0:\"\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:770;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:0:\"\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:1:\"4\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:1102;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"2\";s:10:\"totalraids\";s:1:\"1\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"2\";s:12:\"totaltackles\";s:1:\"7\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:1115;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"192\";}s:3:\"pts\";s:1:\"2\";s:10:\"totalraids\";s:1:\"2\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"2\";s:12:\"totaltackles\";s:1:\"5\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:1142;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:1:\"2\";s:10:\"totalraids\";s:1:\"7\";s:8:\"touchpts\";s:1:\"2\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:1:\"5\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:1166;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:0:\"\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:1:\"2\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:763;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:1:\"1\";s:10:\"totalraids\";s:1:\"1\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:0:\"\";s:6:\"status\";s:3:\"sub\";s:3:\"sub\";s:1:\"0\";}i:774;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"192\";}s:3:\"pts\";s:1:\"1\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"1\";s:12:\"totaltackles\";s:1:\"2\";s:6:\"status\";s:3:\"sub\";s:3:\"sub\";s:1:\"0\";}i:1165;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"4\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"4\";s:12:\"totaltackles\";s:1:\"4\";s:6:\"status\";s:3:\"sub\";s:3:\"sub\";s:1:\"0\";}}i:691;a:9:{i:0;a:6:{s:3:\"pts\";s:0:\"\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:0:\"\";}i:811;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:1:\"5\";s:10:\"totalraids\";s:2:\"11\";s:8:\"touchpts\";s:1:\"4\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"1\";s:12:\"totaltackles\";s:1:\"1\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:816;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:1:\"7\";s:10:\"totalraids\";s:2:\"11\";s:8:\"touchpts\";s:1:\"6\";s:8:\"bonuspts\";s:1:\"1\";s:9:\"tacklepts\";s:1:\"0\";s:12:\"totaltackles\";s:1:\"0\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:817;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"190\";}s:3:\"pts\";s:2:\"15\";s:10:\"totalraids\";s:2:\"18\";s:8:\"touchpts\";s:2:\"13\";s:8:\"bonuspts\";s:1:\"2\";s:9:\"tacklepts\";s:0:\"\";s:12:\"totaltackles\";s:0:\"\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:820;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"2\";s:10:\"totalraids\";s:1:\"1\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"2\";s:12:\"totaltackles\";s:1:\"4\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:821;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"2\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"2\";s:12:\"totaltackles\";s:1:\"6\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:822;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"1\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"1\";s:12:\"totaltackles\";s:1:\"3\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:1090;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"3\";s:10:\"totalraids\";s:0:\"\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:0:\"\";s:9:\"tacklepts\";s:1:\"3\";s:12:\"totaltackles\";s:2:\"10\";s:6:\"status\";s:6:\"lineup\";s:3:\"sub\";s:1:\"0\";}i:805;a:10:{s:6:\"number\";s:0:\"\";s:8:\"position\";a:1:{i:0;s:3:\"193\";}s:3:\"pts\";s:1:\"3\";s:10:\"totalraids\";s:1:\"4\";s:8:\"touchpts\";s:0:\"\";s:8:\"bonuspts\";s:1:\"1\";s:9:\"tacklepts\";s:1:\"2\";s:12:\"totaltackles\";s:1:\"2\";s:6:\"status\";s:3:\"sub\";s:3:\"sub\";s:1:\"0\";}}}"
         ],
         "sp_order":[
            "a:0:{}"
         ],
         "sp_timeline":[
            "a:2:{i:688;a:10:{i:764;a:1:{s:3:\"sub\";a:1:{i:0;s:0:  \"\";}}i:765;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:770;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1102;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1115;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1142;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1166;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:763;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:774;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1165;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}}i:691;a:8:{i:811;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:816;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:817;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:820;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:821;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:822;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:1090;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}i:805;a:1:{s:3:\"sub\";a:1:{i:0;s:0:\"\";}}}}"
         ],
         "sp_stars":[
            "a:1:{i:817;s:1:\"1\";}"
         ],
         "sp_specs":[
            "a:1:{s:4:\"zone\";s:1:\"A\";}"
         ],
         "sp_video":[
            ""
         ],
         "sp_team":[
            "688",
            "691"
         ],
         "sp_player":[
            "0",
            "763",
            "764",
            "765",
            "770",
            "774",
            "1102",
            "1115",
            "1142",
            "1165",
            "1166",
            "0",
            "805",
            "811",
            "816",
            "817",
            "820",
            "821",
            "822",
            "1090"
         ],
         "sp_staff":[
            "0",
            "0"
         ]
      }
   },
   "previous_url":"http:\/\/fantasy-arena.com\/event\/match-19-bengaluru-bulls-vs-tamil-thalaivas\/",
   "next_url":"http:\/\/fantasy-arena.com\/event\/match-21-haryana-steelers-vs-dabang-delhi-k-c\/"
}

2 个答案:

答案 0 :(得分:0)

您可以使用JSON String Escape从您的JSON中删除无用的slashes()。

然后使用jsonschema2pojo创建模型类。然后您可以从JSON获取任何数据

在您的 build.gradle

中添加GSON依赖项
  dependencies {
      implementation 'com.google.code.gson:gson:2.8.5'
    }

将JSON放入JsonSchema2Pojo后,我得到了这些类,您可以使用这些模型来获取所需的任何数据。

MyData.java(主要模型类)

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class MyData {    
    @SerializedName("status")
    @Expose
    private String status;
    @SerializedName("post")
    @Expose
    private Post post;
    @SerializedName("previous_url")
    @Expose
    private String previousUrl;
    @SerializedName("next_url")
    @Expose
    private String nextUrl;

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Post getPost() {
        return post;
    }

    public void setPost(Post post) {
        this.post = post;
    }

    public String getPreviousUrl() {
        return previousUrl;
    }

    public void setPreviousUrl(String previousUrl) {
        this.previousUrl = previousUrl;
    }

    public String getNextUrl() {
        return nextUrl;
    }

    public void setNextUrl(String nextUrl) {
        this.nextUrl = nextUrl;
    }

}

Author.java

public class Author {

    @SerializedName("id")
    @Expose
    private Integer id;
    @SerializedName("slug")
    @Expose
    private String slug;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("first_name")
    @Expose
    private String firstName;
    @SerializedName("last_name")
    @Expose
    private String lastName;
    @SerializedName("nickname")
    @Expose
    private String nickname;
    @SerializedName("url")
    @Expose
    private String url;
    @SerializedName("description")
    @Expose
    private String description;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSlug() {
        return slug;
    }

    public void setSlug(String slug) {
        this.slug = slug;
    }

    public String getName() {
        return name;
    }

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

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}

CustomFields.java

public class CustomFields {

    @SerializedName("sp_status")
    @Expose
    private List<String> spStatus = null;
    @SerializedName("sp_format")
    @Expose
    private List<String> spFormat = null;
    @SerializedName("sp_mode")
    @Expose
    private List<String> spMode = null;
    @SerializedName("sp_day")
    @Expose
    private List<String> spDay = null;
    @SerializedName("sp_minutes")
    @Expose
    private List<String> spMinutes = null;
    @SerializedName("sp_results")
    @Expose
    private List<String> spResults = null;
    @SerializedName("sp_result_columns")
    @Expose
    private List<String> spResultColumns = null;
    @SerializedName("sp_players")
    @Expose
    private List<String> spPlayers = null;
    @SerializedName("sp_order")
    @Expose
    private List<String> spOrder = null;
    @SerializedName("sp_timeline")
    @Expose
    private List<String> spTimeline = null;
    @SerializedName("sp_stars")
    @Expose
    private List<String> spStars = null;
    @SerializedName("sp_specs")
    @Expose
    private List<String> spSpecs = null;
    @SerializedName("sp_video")
    @Expose
    private List<String> spVideo = null;
    @SerializedName("sp_team")
    @Expose
    private List<String> spTeam = null;
    @SerializedName("sp_player")
    @Expose
    private List<String> spPlayer = null;
    @SerializedName("sp_staff")
    @Expose
    private List<String> spStaff = null;

    public List<String> getSpStatus() {
        return spStatus;
    }

    public void setSpStatus(List<String> spStatus) {
        this.spStatus = spStatus;
    }

    public List<String> getSpFormat() {
        return spFormat;
    }

    public void setSpFormat(List<String> spFormat) {
        this.spFormat = spFormat;
    }

    public List<String> getSpMode() {
        return spMode;
    }

    public void setSpMode(List<String> spMode) {
        this.spMode = spMode;
    }

    public List<String> getSpDay() {
        return spDay;
    }

    public void setSpDay(List<String> spDay) {
        this.spDay = spDay;
    }

    public List<String> getSpMinutes() {
        return spMinutes;
    }

    public void setSpMinutes(List<String> spMinutes) {
        this.spMinutes = spMinutes;
    }

    public List<String> getSpResults() {
        return spResults;
    }

    public void setSpResults(List<String> spResults) {
        this.spResults = spResults;
    }

    public List<String> getSpResultColumns() {
        return spResultColumns;
    }

    public void setSpResultColumns(List<String> spResultColumns) {
        this.spResultColumns = spResultColumns;
    }

    public List<String> getSpPlayers() {
        return spPlayers;
    }

    public void setSpPlayers(List<String> spPlayers) {
        this.spPlayers = spPlayers;
    }

    public List<String> getSpOrder() {
        return spOrder;
    }

    public void setSpOrder(List<String> spOrder) {
        this.spOrder = spOrder;
    }

    public List<String> getSpTimeline() {
        return spTimeline;
    }

    public void setSpTimeline(List<String> spTimeline) {
        this.spTimeline = spTimeline;
    }

    public List<String> getSpStars() {
        return spStars;
    }

    public void setSpStars(List<String> spStars) {
        this.spStars = spStars;
    }

    public List<String> getSpSpecs() {
        return spSpecs;
    }

    public void setSpSpecs(List<String> spSpecs) {
        this.spSpecs = spSpecs;
    }

    public List<String> getSpVideo() {
        return spVideo;
    }

    public void setSpVideo(List<String> spVideo) {
        this.spVideo = spVideo;
    }

    public List<String> getSpTeam() {
        return spTeam;
    }

    public void setSpTeam(List<String> spTeam) {
        this.spTeam = spTeam;
    }

    public List<String> getSpPlayer() {
        return spPlayer;
    }

    public void setSpPlayer(List<String> spPlayer) {
        this.spPlayer = spPlayer;
    }

    public List<String> getSpStaff() {
        return spStaff;
    }

    public void setSpStaff(List<String> spStaff) {
        this.spStaff = spStaff;
    }

}

Post.java

public class Post {

    @SerializedName("id")
    @Expose
    private Integer id;
    @SerializedName("type")
    @Expose
    private String type;
    @SerializedName("slug")
    @Expose
    private String slug;
    @SerializedName("url")
    @Expose
    private String url;
    @SerializedName("status")
    @Expose
    private String status;
    @SerializedName("title")
    @Expose
    private String title;
    @SerializedName("title_plain")
    @Expose
    private String titlePlain;
    @SerializedName("content")
    @Expose
    private String content;
    @SerializedName("excerpt")
    @Expose
    private String excerpt;
    @SerializedName("date")
    @Expose
    private String date;
    @SerializedName("modified")
    @Expose
    private String modified;
    @SerializedName("categories")
    @Expose
    private List<Object> categories = null;
    @SerializedName("tags")
    @Expose
    private List<Object> tags = null;
    @SerializedName("author")
    @Expose
    private Author author;
    @SerializedName("comments")
    @Expose
    private List<Object> comments = null;
    @SerializedName("attachments")
    @Expose
    private List<Object> attachments = null;
    @SerializedName("comment_count")
    @Expose
    private Integer commentCount;
    @SerializedName("comment_status")
    @Expose
    private String commentStatus;
    @SerializedName("custom_fields")
    @Expose
    private CustomFields customFields;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getSlug() {
        return slug;
    }

    public void setSlug(String slug) {
        this.slug = slug;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitlePlain() {
        return titlePlain;
    }

    public void setTitlePlain(String titlePlain) {
        this.titlePlain = titlePlain;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getExcerpt() {
        return excerpt;
    }

    public void setExcerpt(String excerpt) {
        this.excerpt = excerpt;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getModified() {
        return modified;
    }

    public void setModified(String modified) {
        this.modified = modified;
    }

    public List<Object> getCategories() {
        return categories;
    }

    public void setCategories(List<Object> categories) {
        this.categories = categories;
    }

    public List<Object> getTags() {
        return tags;
    }

    public void setTags(List<Object> tags) {
        this.tags = tags;
    }

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    public List<Object> getComments() {
        return comments;
    }

    public void setComments(List<Object> comments) {
        this.comments = comments;
    }

    public List<Object> getAttachments() {
        return attachments;
    }

    public void setAttachments(List<Object> attachments) {
        this.attachments = attachments;
    }

    public Integer getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Integer commentCount) {
        this.commentCount = commentCount;
    }

    public String getCommentStatus() {
        return commentStatus;
    }

    public void setCommentStatus(String commentStatus) {
        this.commentStatus = commentStatus;
    }

    public CustomFields getCustomFields() {
        return customFields;
    }

    public void setCustomFields(CustomFields customFields) {
        this.customFields = customFields;
    }
}

答案 1 :(得分:0)

有两个选择

  1. 使用普通的JSONObject手动解析数据
  2. 使用某些库(即Gson)将数据自动映射到Java对象字段