【发布时间】:2016-12-19 01:40:35
【问题描述】:
我对一种 JSON 类型有疑问。
例子:
{
"1": "name",
"2": "example",
"3": "loremipsum",
"4": "etc",
}
我总是使用 Gson 将 json 转换为 POJO。我正在使用改造 1.9
但在这种情况下它很愚蠢,因为我收到了这样的对象:
public class Example {
@SerializedName("1")
@Expose
private String _1;
@SerializedName("2")
@Expose
private String _2;
@SerializedName("3")
@Expose
private String _3;
@SerializedName("4")
@Expose
private String _4;
.........
如何解析这个 JSON 以接收对象列表,例如:
public class Example {
private int id;
private String value;
}
感谢您的帮助。
【问题讨论】:
-
我认为你需要这个:- stackoverflow.com/questions/33758601/…>
标签: android json gson retrofit