Java 解析不同类型的json对象并在recyclerview中列出数据

Java 解析不同类型的json对象并在recyclerview中列出数据,java,android,json,Java,Android,Json,我是json解析的新手。我知道如何解析普通的json对象,但我不知道如何解析下面列出的json类型。有人能帮我吗 我知道如何解析这种json [{"id":"1","image_title":"Android 1.5 Cupcake","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&t

我是json解析的新手。我知道如何解析普通的json对象,但我不知道如何解析下面列出的json类型。有人能帮我吗

我知道如何解析这种json

[{"id":"1","image_title":"Android 1.5 Cupcake","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"2","image_title":"Android 1.6 Donut","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"3","image_title":"Android 2.0 Eclair","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"4","image_title":"Android 2.2 Froyo","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"5","image_title":"Android 2.3 GingerBread","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"6","image_title":"Android 3.0 HoneyComb","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"7","image_title":"Android 4.0 Ice Cream Sandwich","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"8","image_title":"Android 4.1 Jelly Bean","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"},{"id":"9","image_title":"Android 4.4 KitKat","image_url":"https://firebasestorage.googleapis.com/v0/b/sukshichat.appspot.com/o/Wrangler%2FIMG_20171102_141451.jpg?alt=media&token=ce3f2747-a36f-416d-9dfc-ecfb6be4b447"}]
但我不知道如何解析它并在recyclerview中附加值

    {
    "id": {
        "0": "1",
        "5": "2",
        "6": "3",
        "10": "4",
        "12": "5"
    },
    "image_title": {
        "0": "Blue",
        "5": "Black",
        "6": "Yellow",
        "10": "Orange",
        "12": "Voilet"
    }
}
我的完整JSON响应

    {
  "Store EAN Number": {
    "0": null,
    "5": null,
    "6": null,
    "10": null,
    "12": null
  },
  "SKU Code": {
    "0": null,
    "5": null,
    "6": null,
    "10": null,
    "12": null
  },
  "Mihu EAN Number": {
    "0": 9999922000001,
    "5": 9999922000006,
    "6": 9999922000007,
    "10": 9999922000011,
    "12": 9999922000013
  },
  "Style Code": {
    "0": "Vico0001",
    "5": "Vico0006",
    "6": "Vico0007",
    "10": "Vico0011",
    "12": "Vico0013"
  },
  "Store": {
    "0": "Vision Colour",
    "5": "Vision Colour",
    "6": "Vision Colour",
    "10": "Vision Colour",
    "12": "Vision Colour"
  },
  "Store Code": {
    "0": 22,
    "5": 22,
    "6": 22,
    "10": 22,
    "12": 22
  },
  "Category": {
    "0": "Shirt",
    "5": "Shirt",
    "6": "Shirt",
    "10": "Shirt",
    "12": "Shirt"
  },
  "Gender": {
    "0": "Male",
    "5": "Male",
    "6": "Male",
    "10": "Male",
    "12": "Male"
  },
  "Sleeves Type": {
    "0": "Full Sleeve",
    "5": "Full Sleeve",
    "6": "Full Sleeve",
    "10": "Full Sleeve",
    "12": "Full Sleeve"
  },
  "Collection": {
    "0": "Casual",
    "5": "Casual",
    "6": "Casual",
    "10": "Casual",
    "12": "Casual"
  },
  "Fitting Type": {
    "0": "Slim",
    "5": "Slim",
    "6": "Slim",
    "10": "Slim",
    "12": "Slim"
  },
  " Size ": {
    "0": "M",
    "5": "M",
    "6": "M",
    "10": "M",
    "12": "M"
  },
  "Pocket Type": {
    "0": "No Pocket",
    "5": "V Shape",
    "6": "V Shape",
    "10": "V Shape",
    "12": "V Shape"
  },
  "Fabric Type": {
    "0": "100% cotton",
    "5": "100% cotton",
    "6": "100% cotton",
    "10": "100% cotton",
    "12": "100% cotton"
  },
  "Colour": {
    "0": "White",
    "5": "White",
    "6": "White",
    "10": "White",
    "12": "White"
  },
  "Fabric Design": {
    "0": "Printed",
    "5": "Printed",
    "6": "Printed",
    "10": "Printed",
    "12": "Printed"
  },
  "garment_description": {
    "0": null,
    "5": null,
    "6": null,
    "10": null,
    "12": null
  },
  "garment_name": {
    "0": "White Full Sleeve Printed Shirt",
    "5": "White Full Sleeve Printed Shirt",
    "6": "White Full Sleeve Printed Shirt",
    "10": "White Full Sleeve Printed Shirt",
    "12": "White Full Sleeve Printed Shirt"
  },
  "mrp_price": {
    "0": 450,
    "5": 450,
    "6": 450,
    "10": 450,
    "12": 450
  },
  "discount_price": {
    "0": null,
    "5": null,
    "6": null,
    "10": null,
    "12": null
  }

}
像这样解析:

JsonObject jsonObj = new JsonObject(response);

JsonObject id_jsonObj = jsonObj.getJsonObject("id");

String first = id_jsonObj.getString("0");

String second = id_jsonObj.getString("5");

//and so on

JsonObject image_jsonObj = jsonObj.getJsonObject("image_title");

String title1 = image_jsonObj.getString("0");

String title2 = image_jsonObj.getString("5");

//and so on

上面的first up all可能重复的不是jsonarray。你能告诉我像0,5,6,10,12这样的键是id和图像标题内的静态键还是动态键吗。或者他们会改变你可以显示完整的json数据吗?我已经用完整的json响应编辑了我的问题。id的0,5并不总是相同的。你能解释一下如何动态获取它们吗?你可以这样获取id:JSONArray names=id_jsonObj.names();对于(inti=0;i