gpt4 book ai didi

android - 改造 + GSON 解串器

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:36:50 26 4
gpt4 key购买 nike

我有一个这样的对象:

"choice": {
"000": {
"id": "001",
"label": "test",
"status": "0"
},
"001": {
"id": "001",
"label": "test",
"status": "0"
},
"002": {
"id": "001",
"label": "test",
"status": "0"
},
"003": {
"id": "001",
"label": "test",
"status": "0"
},
"004": {
"id": "001",
"label": "test",
"status": "0"
}
},

如何使用 Gson+Retrofit 解析该对象?或者生成一个POJO?有一种简单的方法可以做到这一点吗?

非常感谢!

最佳答案

你所选择的 json 对象的主要思想是 Map:

public class RootObject{
Map <String,ChoiceEntry> choice;
}

public class ChoiceEntry{
String id;
String label;
int status;
}

关于android - 改造 + GSON 解串器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29478867/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com