【发布时间】:2016-05-18 19:31:04
【问题描述】:
我正在登录。如果数据正确,则返回以下内容:
{
"a": 1,
"b":2,
"c":3
}
如果数据不正确,返回以下内容:
{
"status": false,
"error": {
.... etc
}
}
我的模型应该如何?... 我正在使用 GSON。
我的代码:
Gson gson = new Gson();
//As I can get two types of answers, as would my code?
//Model model = gson.fromJson(my_json, Model.class);
【问题讨论】:
-
为什么不将所有可能的字段放入模型中,然后检查
error是否有null?
标签: android json gson deserialization