如何设计模型 class 以在回收器视图中获取嵌套数组对象?
How the model class will be design to fetch the nested array object in recycler view?
I am using a free IMDB api for Json practicing , but don't know how to fetch these data through recycler view.
Here is the Json api data which I need to fetch.
{
"technical_specs": [
[
"Runtime",
"2 hr 28 min (148 min)"
],
[
"Sound Mix",
"Dolby Digital | DTS | SDDS"
],
[
"Color",
"Color"
],
[
"Aspect Ratio",
"2.39 : 1"
],
[
"Camera",
"Arriflex 235, "
],
[
"Laboratory",
"Imagica Corporation, Shinagawa-ku, "
],
[
"Film Length",
"3,925 m (Portugal) <br> 4,037 m (Sweden)"
],
[
"Negative Format",
"35 mm (also horizontal) (Kodak Vision3 250D 5207, Vision3 500T 5219) <br> 65 mm (Kodak Vision3 250D 5207, Vision3 500T 5219)"
],
[
"Cinematographic Process",
"Panavision (anamorphic) <br> Panavision Super 70 (some scenes) <br> VistaVision (aerial shots)"
],
[
"Printed Film Format",
"35 mm (Kodak Vision 2383) <br> 70 mm (horizontal) (IMAX DMR blow-up) (Kodak Vision 2383) <br> D-Cinema"
]
]
}
I got confused to make a proper model for nested array
在这个JSON响应中,假设“technical_specs”不是固定键,如果你使用Retrofit来获取数据,方法如下,
fun fetchData(): Response<HashMap<String, List<List<String>>>>
然后您可以使用此哈希图填充您的回收器视图,您不需要为此创建任何 Pojo class。
I am using a free IMDB api for Json practicing , but don't know how to fetch these data through recycler view. Here is the Json api data which I need to fetch.
{
"technical_specs": [
[
"Runtime",
"2 hr 28 min (148 min)"
],
[
"Sound Mix",
"Dolby Digital | DTS | SDDS"
],
[
"Color",
"Color"
],
[
"Aspect Ratio",
"2.39 : 1"
],
[
"Camera",
"Arriflex 235, "
],
[
"Laboratory",
"Imagica Corporation, Shinagawa-ku, "
],
[
"Film Length",
"3,925 m (Portugal) <br> 4,037 m (Sweden)"
],
[
"Negative Format",
"35 mm (also horizontal) (Kodak Vision3 250D 5207, Vision3 500T 5219) <br> 65 mm (Kodak Vision3 250D 5207, Vision3 500T 5219)"
],
[
"Cinematographic Process",
"Panavision (anamorphic) <br> Panavision Super 70 (some scenes) <br> VistaVision (aerial shots)"
],
[
"Printed Film Format",
"35 mm (Kodak Vision 2383) <br> 70 mm (horizontal) (IMAX DMR blow-up) (Kodak Vision 2383) <br> D-Cinema"
]
]
}
I got confused to make a proper model for nested array
在这个JSON响应中,假设“technical_specs”不是固定键,如果你使用Retrofit来获取数据,方法如下,
fun fetchData(): Response<HashMap<String, List<List<String>>>>
然后您可以使用此哈希图填充您的回收器视图,您不需要为此创建任何 Pojo class。